ImagePreview 图片预览
... 2021-7-29 Less than 1 minute
可以赋值任赋值图片去放大预览(一张缩略图,一张放大图)
Tips
2.5.3+
如果没有后缀,可以配置type
属性,可选值img/video/audio
<div>
<el-button @click="openPreview(0)" style="margin-bottom:20px;">打开图片预览</el-button>
<p>
<img width="200px" style="margin-right:20px" v-for="(d, index) of datas" :src="d.thumbUrl" @click="openPreview(index)">
</p>
</div>
<script>
export default {
data() {
return {
datas: [
{ thumbUrl: `https://img.alicdn.com/tfs/TB1uevcCrj1gK0jSZFuXXcrHpXa-1880-640.jpg`, url: `https://img.alicdn.com/tfs/TB1uevcCrj1gK0jSZFuXXcrHpXa-1880-640.jpg`,type:'img' },
{ thumbUrl: `https://img.alicdn.com/tfs/TB1v28TC8v0gK0jSZKbXXbK2FXa-1880-640.jpg`, url: `https://www.w3school.com.cn/i/movie.ogg`,type:'img' },
]
}
},
methods: {
openPreview(index = 0) {
this.$ImagePreview(this.datas, index,{
interval:3000,
closeOnClickModal: true,
click:(data,index)=>{
this.$message.success('点击事件'+index)
},
beforeClose:()=>{
this.$message.success('关闭回调')
}
});
}
}
}
</script>
This app can be installed on your PC or mobile device. This will allow this web app to look and behave like any other installed app. You will find it in your app lists and be able to pin it to your home screen, start menus or task bars. This installed web app will also be able to safely interact with other apps and your operating system.