data() {
return {
player: null
}
},
mounted() {
this.player = videojs(this.$refs.videoPlayer, this.options, function onPlayerReady() {
console.log(‘onPlayerReady’, this);
})
},
beforeDestroy() {
if (this.player) {
this.player.dispose()
}
}
}
在页面中使用该组件:样式使用了element ui,需要的可以自行安装
主要的是data中的videoOptions,与组件绑定。
Welcome to my Blog