第一步.配置main.js
import Viewer from 'v-viewer'
Vue.use(Viewer)
第二步:xxx.vue使用
<div class="images" v-viewer="{movable: false}">
<img v-for="src in imgs" :src="src" :key="src"
style="width:1000px;height:400px">
//控制图片大小
</div>
export default {
data(){
imgs:[]
}
}
mounted() {
this.record = this.$tabs.querySelf(this);
this.$request({
url:xxx,
method:get,
params: {
...this.record
}
}).then(res=>{
this.imgs[0]='data:image/png;base64,'+res.pic
})
}
参考文章:https://blog.csdn.net/liang_wf/article/details/102562249
vue–如何根据可视窗口的大小自动调节图片大小
https://blog.csdn.net/weixin_42520375/article/details/103349267