一个好用精简的vuejs轮播插件——vue-swiper
2017-02-12 09:14
821 查看
这个vue轮播插件只有10k大小,使用十分方便
先放官网的使用方法。
http://www.jianshu.com/p/e11505466851
使用
github地址
先放官网的使用方法。
http://www.jianshu.com/p/e11505466851
import Vue from 'vue' import Swiper from 'vue-swiper' new Vue({ el: 'body', components: {Swiper}, methods: { onSlideChangeStart (currentPage) { console.log('onSlideChangeStart', currentPage); }, onSlideChangeEnd (currentPage) { console.log('onSlideChangeEnd', currentPage); } } });
<swiper v-ref:swiper direction="horizontal" :mousewheel-control="true" :performance-mode="false" :pagination-visible="true" :pagination-clickable="true" :loop=“true” @slide-change-start="onSlideChangeStart" @slide-change-end="onSlideChangeEnd"> <div>Page 1</div> <div>Page 2</div> <div>Page 3</div> </swiper>
Api
Properties
Name | Type | Default | Description |
---|---|---|---|
direction | String | "vertical" | Could be 'horizontal' or 'vertical' (for vertical slider). |
mousewheel-control | Boolean | true | Set to true to enable navigation through slides using mouse wheel. |
pagination-visible | Boolean | false | Toggle (hide/true) pagination container visibility when click on Slider's container |
pagination-clickable | Boolean | false | If true then clicking on pagination button will cause transition to appropriate slide. |
performace-mode | Boolean | false | Disable advance effect for better performance. |
loop | Boolean | false | Set to true to enable continuous loop mode |
==================== | ========= | ============ | =================== |
Methods
Method | Description |
---|---|
next() | Go next page. |
prev() | Go previous page. |
setPage(Number) | Set current page number. |
Events
Name | Parameters | Description |
---|---|---|
slide-change-start | pageNumber | Fire in the beginning of animation to other slide (next or previous). |
slide-change-end | pageNumber | Will be fired after animation to other slide (next or previous). |
slide-revert-start | pageNumber | Fire in the beginning of animation to revert slide (no change). |
slide-revert-end | pageNumber | Will be fired after animation to revert slide (no change). |
slider-move | offset | Callback function, will be executed when user touch and move finger over Swiper and move it. Receives swiper instance and 'touchmove' event as an arguments. |
================== | ================ | ============================ |
v-ref:swipe声明后就可以在vue.js中可以使用
this.$refs.swipe来调用
next();prev();setPage(1);等方法
github地址
相关文章推荐
- 分享一个精简的vue.js 图片lazyload插件实例
- 分享一个精简的vue.js 图片lazyload插件
- 强大的js图片轮播插件Swiper
- vue轮播图插件vue-awesome-swiper的使用
- 非常优秀的JS图片轮播插件Swiper的用法
- vue一个组件引入多个swiper轮播可能引发的分页器数量异常问题
- vue中引用swiper轮播插件
- vue2.0引用vue-awesome-swiper插件实现左右滑动轮播效果
- 转一个简单的vue.js的图片懒加载的插件代码!
- js全屏插件-全屏任何一个你想要的元素,单图片or轮播图
- vue轮播图插件vue-awesome-swiper的使用
- vue轮播图插件vue-awesome-swiper的使用代码实例
- Vue.js插件axios——封装一个可以灵活使用的ajax
- 一个用原生JS造的轮播图插件
- vue轮播插件vue-awesome-swiper
- vue-awesome-swiper(轮播图vue插件)
- 使用unslider.js图片轮播插件创建一个能轮播24节气的网页
- vue中引用swiper轮播插件的教程详解
- 几句代码写出一个内容轮播器(jQuery插件的神奇)jQuery.flexslider.js登场!!
- vue轮播图插件vue-awesome-swiper的引入及使用