vue项目插入视频-mp4

1. v.vue文件:

<template>
  <div>
    <div class="contain">
      <my-video :sources="video.sources" :options="video.options" class="video">
      </my-video>
    </div>
  </div>
</template>

<script>
import myVideo from 'vue-video'
export default {
  data() {
    return {
      video: {
        sources: [{
          src: '../../../../static/video/v.mp4'
        }],
        options: {
          autoplay: true,
          volume: 0.6,
          poster: 'http://covteam.u.qiniudn.com/poster.png'
        }
      }
    }
  },
  components: {
    myVideo
  }
}
</script>

2. v.css文件:(video需要一定的宽和高)

.video{
  100px;
  height:100px;
}
致力于前端技术学习与分享,会及时更新博客。
原文地址:https://www.cnblogs.com/caoxueying2018/p/9729299.html