1、可以预览图片、文档、视频等,视频需要安装视频预览插件:cnpm install --save video.js
2、代码:
<!-- @format -->
<template>
<div>
<!--图片-->
<div v-if="imgShow">
<img :src="downloadUrl" />
</div>
<!--doc,excel-->
<div v-else-if="docShow || excelShow">
<iframe
class="child"
frameborder="0"
:src="'https://view.officeapps.live.com/op/view.aspx?src=' + this.downloadUrl"
:style="{ width: width, height: height }"
>
</iframe>
</div>
<!--视频-->
<div v-else-if="videoShow">
<video preload="auto" :height="height" :width="width" align="center" controls="true">
<source :src="downloadUrl" type=&#