1、安装:npm install --save vue-preview
2、在main.js中引入:
import VuePreview from 'vue-preview'
Vue.use(VuePreview)
3、使用:
<vue-preview :slides="imgList"></vue-preview> imgList: [ { src: 'https://xxx.jpg', msrc: 'https://xxx.jpg', alt: 'picture1', title: 'Image Caption 1', w: 600, // 设置图片的宽高,单位px h: 400 }, { src: 'https://xxx.jpg', msrc: 'https://xxx.jpg', alt: 'picture2', title: 'Image Caption 2', w: 1200, h: 900 } ],