cnpm install rview-c --save
<template> <div> <videoShow :videoSrc="videoSrc" :poster="poster" :autoplay="autoplay" :width="width" :height="height" :objectFill="objectFill" :buttonShow="buttonShow" @getBigectURL="getBigectURL" ></videoShow> </div> </template> <script > export default { data() { return { videoSrc: "", poster: "http://img0.imgtn.bdimg.com/it/u=1636028352,29453244&fm=11&gp=0.jpg", autoplay: true, width: "500", height: "400", objectFill:"fill", buttonShow:true, }; }, methods: { getBigectURL(event){ console.log("getBigectURL", event); let current = event.target.files[0]; let fileReader = new FileReader(); fileReader.readAsDataURL(current); let that = this; fileReader.onload = function(e) { that.videoSrc = e.currentTarget.result; }; } } }; </script>
Methds:
参数 |
类型 |
是否必填 |
描述 |
videoSrc |
String |
是 |
视频的URL |
poster |
String |
是 |
视频封面 |
autoplay |
Boolean |
是 |
视频自动播放 |
width |
String |
是 |
视频宽 |
height |
String |
是 |
视频高 |
objectFill |
String |
是 |
视频内容填充 |
getBigectURL |
Function |
是 |
调用本地文件地址 |