VUE图片预览放大缩小插件viewer
一、安装依赖
npm install v-viewer --save
二、main.js内引用并注册调用
//main.jsimport Viewer from 'v-viewer'import 'viewerjs/dist/viewer.css'Vue.use(Viewer);Viewer.setDefaults({Options: {"inline": true, "button": true, "navbar": true, "title": true, "toolbar": true, "tooltip": true, "movable": true, "zoomable": true, "rotatable": true, "scalable": true, "transition": true, "fullscreen": true, "keyboard": true, "url": "data-source" }});
三、代码中使用
<template><div class="content"><h1>Viewer图片预览插件</h1><viewer :images="imgs"><img v-for="src in imgs" :src="src.url" :key="src.title"></viewer></div></template><script>export default {data () {return {imgs: [{url: '/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1547803398,3047886900&fm=26&gp=0.jpg',title: '图片1'},{url: '/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1235440307,3142075557&fm=26&gp=0.jpg',title: '图片2'}]}},}</script>
如果觉得《VUE图片预览放大缩小插件viewer》对你有帮助,请点赞、收藏,并留下你的观点哦!