0.0.13 • Published 7 years ago

vue2-swiper v0.0.13

Weekly downloads
31
License
MIT
Repository
github
Last release
7 years ago

vue2-swiper

一个简单的vue2 swiper 插件

Getting start

NPM

npm install --save vue2-swiper
import {Swiper} from 'vue2-swiper'

new Vue({
    el: '#app',
    components: {
        Swiper
    }
})
<swiper>
<div v-for="n in 3">page {{n}}</div>
</swiper>

or you can import vue2Swiper in main.js

import Vue from 'vue'
import vue2Swiper from 'vue2-swiper'
Vue.use(vue2Swiper)

HTML

<script type="text/javascript" src="path/to/vue.js"></script>
<script type="text/javascript" src="path/to/vue2Swiper.js"></script>
<script>
Vue.use(vue2Swiper)
var vm = new Vue({
  el: '#app'
 })
</script>

Demo & Document

  • git clone https://github.com/fchengjin/vue2-swiper
  • cd vue2-swiper
  • npm install
  • npm run dev
  • it will open the demo at 127.0.0.1:3030
  • or you can see the DEMO here

Api

props

NameTypeDefaultDescription
directionString"horizontal"Could be 'horizontal' or 'vertical' (for vertical slider).
mousewheel-controlBooleanfalseSet to true to enable navigation through slides using mouse wheel.
pagination-visibleBooleanfalseToggle (hide/true) pagination container visibility when click on Slider's container
pagination-clickableBooleanfalseIf true then clicking on pagination button will cause transition to appropriate slide.
performace-modeBooleanfalseDisable advance effect for better performance.
loopBooleanfalseSet true to enable the loop mode
speedBoolean500swiper switching speed
active-indexNumber1The active page when initializing
no-boundsBooleanfalseIf you want the first page can not slide to left ,or the last page can not slide to right , you should set noBounds to true.
forbidden-slideBooleanfalseIf true, you can not change the swiper by sliding
tab-modeArray-f you set tabMode , it will add a tabnav above the swiper-slider.
tab-mode-animationBooleanfalseIf you just use the tab as a nav, you can set tabModeAnimation to true.
customize-navString-customize-nav is a dom selector, you can place it anywhere you want.
customize-nav-active-classStringactivecustomize-nav-active-class
nestedBooleanfalsef you want nest the swiper , you should add nested property to the children

Methods

MethodDescription
next()switch to next slider
prev()switch to previous slider
setPage(pageNumber : Number,noAnimation : Boolean)NoAnimation is optional parameter, if set true, there is no transition animation when switching

Events

NameParametersDescription
slide-change-startpageNumberFire in the beginning of animation to other slide (next or previous).
slide-change-endpageNumberWill be fired after animation to other slide (next or previous).
slide-revert-startpageNumberFire in the beginning of animation to revert slide (no change).
slide-revert-endpageNumberWill be fired after animation to revert slide (no change).
slider-moveoffsetCallback function, will be executed when user touch and move finger over Swiper and move it. Receives swiper instance and 'touchmove' event as an arguments.
0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.5

7 years ago

0.0.2

7 years ago

0.0.3

7 years ago