vue项目使用xgplayer西瓜视频播放器
<template><div id="app">11111<div id="vs"></div></div></template><script>// import HelloWorld from './components/HelloWorld.vue'import Player from 'xgplayer';
·
第一步先安装:
npm install xgplayer
第二步,使用:
<template>
<div id="app">
<div id="vs"></div>
</div>
</template>
<script>
// import HelloWorld from './components/HelloWorld.vue'
import Player from 'xgplayer';
export default {
name: 'App',
data() {
return {
player: null
}
},
components: {
},
mounted() {
this.player = new Player({
id: "vs",
url: 'https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/byted-player-videos/1.0.0/xgplayer-demo.mp4'
})
}
}
</script>
记得获取dom要在mounted之后才能拿得到,created的时候拿不到
更多推荐
已为社区贡献39条内容
所有评论(0)