video视频重新开始播放currentTime
在 react 中可以使用document.getElementById('video')获取元素。video.currentTime = 0 把播放时间设置为从零开始。vue项目中 需要每次点击出视频的时候重头开始播放。在vue 项目中用的 ref 获取的元素。video.pause() 暂停视频。video.play() 播放视频。autoplay自动播放。control 有控制条。
·
vue项目中 需要每次点击出视频的时候重头开始播放
在vue 项目中用的 ref 获取的元素
在 react 中可以使用 document.getElementById('video') 获取元素
autoplay 自动播放
control 有控制条
video.currentTime = 0 把播放时间设置为从零开始
video.play() 播放视频
video.pause() 暂停视频
<video v-if="isVideo" ref="video" :src="lookImgSrc" autoplay control />
watch: {
modal: function (val) {
if (val) {
this.isVideo = true
if (this.$refs.video) {
this.$refs.video.currentTime = 0
this.$refs.video.play()
}
}
},
},
更多推荐




所有评论(0)