怪味曹小豆

导航

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{
  width:100px;
  height:100px;
}

 

posted on 2018-09-30 13:57  怪味曹小豆  阅读(1905)  评论(0)    收藏  举报