uv-preview-video.vue
789 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<template>
<uv-popup ref="popup" @change="change">
<view class="video-view" v-if="show">
<video class="video" :src="getSec" :autoplay="autoplay"></video>
</view>
</uv-popup>
</template>
<script>
export default {
props: {
src: {
type: String,
default: ''
},
autoplay: {
type: Boolean,
default: true
}
},
data() {
return {
videoSrc: '',
show: false
}
},
computed: {
getSec() {
return this.src || this.videoSrc;
}
},
methods: {
open(url) {
this.videoSrc = url;
this.$refs.popup.open();
},
close() {
this.$refs.popup.close();
},
change(e) {
this.show = e.show;
}
}
}
</script>
<style scoped lang="scss">
.video-view {
width: 750rpx;
.video {
width: 750rpx;
}
}
</style>