1.v-view
链接地址
demo地址
效果图:
2.vue-preview
链接地址
3.vue-photo-preview
链接地址
demo地址
4.avue中的ImagePreview
链接地址
官网地址
<div class="imagepreview-1-vue">
<el-button @click="openPreview(0)" style="margin-bottom:20px;">打开图片预览</el-button>
<p>
<img v-for="(d, index) of datas" :src="d.thumbUrl" @click="openPreview(index)">
</p>
</div>
<script>
export default {
data() {
const link = 'https://lokeshdhakar.com/projects/lightbox2/images/';
return {
datas: [
{ thumbUrl: `${link}thumb-4.jpg`, url: `${link}image-4.jpg` },
{ thumbUrl: `${link}thumb-5.jpg`, url: `${link}image-5.jpg` },
{ thumbUrl: `${link}thumb-6.jpg`, url: `${link}image-6.jpg` },
]
}
},
methods: {
openPreview(index = 0) {
this.$ImagePreview(this.datas, index);
}
}
}
</script>