vue 首先在
<template>
<div>
<el-image-viewer
v-if="showViewer"
:on-close="closeViewer"
:url-list="[url]"
/>
</div>
</template>
<script>
//引入el-image-viewer
import ElImageViewer from 'element-ui/packages/image/src/image-viewer'
export default {
components: {
ElImageViewer,//注冊
},
data() {
return {
url:'',//放大的圖片
showViewer:false//打開預(yù)覽/關(guān)閉
}
},
methods: {
closeViewer(){ //關(guān)閉
this.showViewer = false
},
lodData(){
//這里可以寫接口 用返回的圖片賦值 給 url
},
}
</script>