欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue-dplayer 視頻播放器實例代碼

 更新時間:2019年11月08日 08:38:25   作者:asing1elife  
今天小編就為大家分享一篇vue-dplayer 視頻播放器實例代碼,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

官網(wǎng)

vue-dplayer

dplayer-doc

示例

如果默認(rèn) options 中沒有視頻鏈接,之后設(shè)置視頻鏈接時,直接通過 this.options.video.url = videoPath 是無效的

需要先獲取到播放器的實例 this.$refs.player.dp ,然后通過 switchVideo() 對 url 進(jìn)行修改

<template>
 <d-player ref="player" :options="options"></d-player>
</template>

<script type="text/ecmascript-6">
 import dPlayer from 'vue-dplayer'
 import 'vue-dplayer/dist/vue-dplayer.css'

 export default {
 name: 'in-video',
 props: {
  source: {
  type: String,
  default: ''
  }
 },
 data () {
  return {
  player: null,
  options: {
   video: {
   url: ''
   },
   contextmenu: [
   {}
   ]
  }
  }
 },
 mounted() {
  this.player = this.$refs.player.dp
 },
 created() {
  this._setVideoUrl(this.source)
 },
 methods: {
  // 設(shè)置視頻播放路徑
  _setVideoUrl (url) {
  this.player.switchVideo({
   url: url
  })
  }
 },
 components: {
  dPlayer
 }
 }
</script>


相關(guān)文章

最新評論