vue2.0使用swiper组件实现轮播
2017-07-19 15:28
1106 查看
1、安装swiper
2、引用组件
3、html页面代码
4、初始化组件,并设置参数
5、搞定,ok
npm install swiper@3.4.1 --save-dev
2、引用组件
import Swiper from 'swiper'; import 'swiper/dist/css/swiper.min.css';
3、html页面代码
<div class="swiper-container" id="swiper"> <div class="swiper-wrapper"> <div class="swiper-slide" v-for="(item,$index) in detail.imgs"> <a v-on:click="showPreview($index,detail.imgs,swiperObj)"> <figure class="wp-avatar banner"> <img v-cloak :src="item | toQiNiuImg"/> </figure> </a> </div> </div> <!-- Add Pagination --> <div class="swiper-pagination"></div> </div>
4、初始化组件,并设置参数
setTimeout(function () { state.swiperObj = new Swiper('#swiper', { loop: true, pagination: '.swiper-pagination', autoplay: 2000, paginationClickable: true }); }, 100)
5、搞定,ok
相关文章推荐
- vue2.0使用swiper组件实现轮播效果
- vue2.0使用swiper组件实现轮播的示例代码
- vue2.0 使用element-ui里的upload组件实现图片预览效果方法
- 微信小程序使用swiper组件实现类3D轮播图
- vue2.0 使用element-ui里的upload组件实现图片预览效果
- 详解vue2.0 使用动态组件实现 Tab 标签页切换效果(vue-cli)
- 微信小程使用swiper组件实现图片轮播切换显示功能【附源码下载】
- vue2.0使用动态组件实现tab切换效果(vue-cli)
- Vue2.0与 [百度地图] 结合使用———vue+webpack+axios+百度地图实现组件之间的通信
- 详解vue2.0 使用动态组件实现 Tab 标签页切换效果(vue-cli)
- 轮播组件Swiper实现移动端网站的内容触摸滑动使用方法
- Vue2.0与 [百度地图] 结合使用———vue+webpack+axios+百度地图实现组件之间的通信
- vue2.0 使用element-ui里的upload组件实现多图上传。采用FORMDATA的方式上传。
- wc-swiper:基于 Vue 实现的 移动端图片轮播组件
- vue2.0引用vue-awesome-swiper插件实现左右滑动轮播效果
- Vue 2.0 制作列表组件,实现分页、搜索、批量操作等
- Vue2.0 keep-alive 后组件不使用缓存
- vue轮播图插件vue-awesome-swiper的使用
- vue轮播图插件vue-awesome-swiper的使用代码实例