一、vue2
1、安装
npm install [email protected] npm i -S viewerjs
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、使用
<el-carousel :interval="4000" arrow="always" height="150px" :autoplay="true" :loop="true" indicator-position="none" style="width: 350px;margin-left: 7px"> <el-carousel-item v-for="(item,index) in point.carouselList" :key="index"> <img :src="item" style="width: 100%;height: 100%;background-size: contain" v-viewer> </el-carousel-item> </el-carousel>
标签:npm,轮播,预览,viewer,Viewer,Carousel,import,true From: https://www.cnblogs.com/zwh0910/p/18203504