vue使用v-viewer插件實現圖片放大縮小功能


1、先安裝依賴
npm install v-viewer --save
2、main.js內引用並注冊調用

代碼:

// 圖片放大縮小功能
import 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" }
});

 

3、代碼中使用xxx.vue

代碼:

 <p>
                    <viewer :images="imgData" class="certificate-photos">
                        <img v-for="src in imgData" :src="src" :key="src">
                    </viewer>
   </p>

 

 

4.實現效果

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM