第一步先安装:

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的时候拿不到

Logo

前往低代码交流专区

更多推荐