html
<video ref="video" :src="videoUrl" controls @timeupdate="timeupdate"></video>
script
export default {
name: '',
data() {
return {
maxTime: 0,
currentTime : 0,
}
},
methods: {
timeupdate(e) {
if (e.srcElement.currentTime - this.currTime > 1) e.srcElement.currentTime = this.currTime > this.maxTime ? this.currentTime : this.maxTime
this.currentTime = e.srcElement.currentTime
this.maxTime = this.currentTime > this.maxTime ? this.currentTime : this.maxTime
},
},
}
版权声明:本文为CLdemies原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。