已添加elementUI,先引入组件:
import ElImageViewer from 'element-ui/packages/image/src/image-viewer.vue'
添加展示大图的控件元素:
<el-image-viewer
v-if="showViewer"
:on-close="closeViewer"
:url-list="picList" />
控制显示的变量和数据源:
private showViewer: boolean = false
private picList: any = []
private closeViewer() {
this.showViewer = false
}
获取图片list后赋值picList并show出来:
this.showViewer = true