Showing
2 changed files
with
10 additions
and
3 deletions
| ... | ... | @@ -11,7 +11,7 @@ |
| 11 | 11 | > |
| 12 | 12 | <div class="video-sty"> |
| 13 | 13 | <div> |
| 14 | - <vue3videoPlay v-bind="options" :poster="videoPoster" /> | |
| 14 | + <vue3videoPlay :src="videoUrl" ref="videoRef" v-bind="options" :poster="videoPoster" /> | |
| 15 | 15 | </div> |
| 16 | 16 | </div> |
| 17 | 17 | </BasicModal> |
| ... | ... | @@ -32,11 +32,14 @@ |
| 32 | 32 | emits: ['success', 'register'], |
| 33 | 33 | setup() { |
| 34 | 34 | let options: any = reactive({}); |
| 35 | + const videoRef: any = ref(null); | |
| 36 | + const videoUrl = ref<String>(''); | |
| 35 | 37 | const videoPoster = ref(''); |
| 36 | 38 | const heightNum = ref(800); |
| 37 | 39 | const [register] = useModalInner(async (data) => { |
| 38 | 40 | if (data) { |
| 39 | 41 | if (data.record.videoUrl) { |
| 42 | + videoUrl.value = data.record.videoUrl; | |
| 40 | 43 | nextTick(() => { |
| 41 | 44 | /** |
| 42 | 45 | * options配置项(使用vue3-video-play插件) |
| ... | ... | @@ -73,13 +76,18 @@ |
| 73 | 76 | } |
| 74 | 77 | } |
| 75 | 78 | }); |
| 76 | - const handleCancel = () => {}; | |
| 79 | + const handleCancel = () => { | |
| 80 | + //关闭暂停播放视频 | |
| 81 | + videoRef.value.pause(); | |
| 82 | + }; | |
| 77 | 83 | return { |
| 78 | 84 | register, |
| 79 | 85 | handleCancel, |
| 80 | 86 | options, |
| 81 | 87 | heightNum, |
| 82 | 88 | videoPoster, |
| 89 | + videoRef, | |
| 90 | + videoUrl, | |
| 83 | 91 | }; |
| 84 | 92 | }, |
| 85 | 93 | }); | ... | ... |