vue Published preview

The first: viewerjs use presentation (PC, mobile terminal compatible)

1, first install dependencies

 npm install v-viewer --save 

2, reference and registration call within main.js

//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, the code used xxx.vue

<template>
    <div class="content">
        <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: '../../static/image/aze.jpg', 
            Title: ' Chapman ' 
        }, 
        { 
          URL: ' https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3564877025,796183547&fm=27&gp=0.jpg ' , 
          title: ' Picture 2 ' 
        } 
      ] 
    } 
  } , 
} 
</ Script >

The above v-viewer with this blogger is very good, of course, there are other plug-ins we can to try

Suitable for mobile end image preview plug-vue-photo-preview

vue2-preview:https://www.jianshu.com/p/37ff607ad2b4

Reference: https: //www.jianshu.com/p/e3350aa1b0d0

Guess you like

Origin www.cnblogs.com/zhengzemin/p/v-viewer_vue-photo-preview.html