https://blog.csdn.net/liang_wf/article/details/102562249
npm install v-viewer
<template> <div id="app"> <div class="images" v-viewer="{movable: false}"> <img v-for="src in images" :src="src" :key="src"> </div> <button type="button" @click="show">Show</button> </div> </template> <script> import 'viewerjs/dist/viewer.css' import Viewer from 'v-viewer' import Vue from 'vue' Vue.use(Viewer) export default { data() { images: ['1.jpg', '2.jpg'] }, methods: { show () { const viewer = this.$el.querySelector('.images').$viewer viewer.show() } } } </script>