Commit 6e46cb65 by 胡悦

视频添加默认图,以及弹窗关闭视频播放

1 parent 6541adff
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
<video id="video" width="100%" height="100%" preload="none" loop muted> <video id="video" width="100%" height="100%" preload="none" loop muted>
<source :src="item" type="video/mp4" /> <source :src="item" type="video/mp4" />
</video> </video>
<img
class="video-poster"
src="../../../../assets/video-default.png"
/>
<div class="mask"> <div class="mask">
<div <div
class="pic-pane-close" class="pic-pane-close"
...@@ -199,6 +203,20 @@ export default { ...@@ -199,6 +203,20 @@ export default {
default: -1 default: -1
} }
}, },
watch: {
dialogVisibleImg(val) {
if (!val) {
// 关闭所有视频播放
const videos = document.querySelectorAll('.preVideo');
videos.forEach(video => {
if (video && !video.paused) {
video.pause();
video.currentTime = 0;
}
});
}
}
},
data() { data() {
return { return {
uploading: false, uploading: false,
...@@ -471,6 +489,16 @@ export default { ...@@ -471,6 +489,16 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.video-poster {
position: absolute;
width: 104px;
height: 104px;
object-fit: fill;
top: 0;
right: 0;
left: 0;
bottom: 0;
}
.mask { .mask {
display: flex; display: flex;
align-items: center; align-items: center;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!