1.0.9 • Published 6 years ago

vue-light-swiper v1.0.9

Weekly downloads
17
License
MIT
Repository
github
Last release
6 years ago

npm npm GitHub release GitHub issues GitHub stars travis test

NPM

vue-swiper

vue swiper for vue 2.0. light weight and simple

Examples

basic demo

Install

npm install vue-light-swiper --save-dev

Usage

import Vue from 'vue'
import VueSwiper from 'vue-light-swiper'

new Vue({
    el: 'body',
    components: {
        vueSwiper: VueSwiper.vueSwiper,
        vueSwiperSlide: VueSwiper.vueSwiperSlide
    },
    methods: {
        slideChange(index, oldIndex){
            console.log('showIndexChange:', index, oldIndex);
        },
    }
});
<vue-swiper indicators @slide-change="slideChange">
    <vue-swiper-slide>Page 1</vue-swiper-slide>
    <vue-swiper-slide>Page 2</vue-swiper-slide>
    <vue-swiper-slide>Page 3</vue-swiper-slide>
</vue-swiper>

Usage in ssr

import {vueSwiper, vueSwiperSlide} from 'vue-light-swiper/src';

Use lazyload

<vue-swiper uselazyload :preload="1">
    <vue-swiper-slide class="swiper-item" :key="item.src" v-for="(item, index) in bannerList">
        <img class="lazy" :data-src="item.src">
    </vue-swiper-slide>
</vue-swiper>

Api

Properties

NameTypeDefaultDescription
showIndexNumber0Set the swiper item show index, can use .sync modifier.
autoNumber0Set the swiper autoplay interval time, unit ms.
defaultDurationNumber300Set the swiper defaultDuration for transitionDuration, unit ms.
loopBooleanfalseSet whether you need swiper loop.
verticalBooleanfalseSet whether you need a vertical swiper.
indicatorsBooleanfalseSet whether you need indicators.
limitNumber20Set the limit of swiper slide change, unit px.
uselazyloadBooleanfalseSet whether use lazyload.
preloadNumber0Set lazyload preload number.
baseWidthNumber0Set swiper base width, unit px. (default width is swiper's width, but when you init a swiper with invisible, default width can not be set right, you need set base width in this time.)
baseHeightNumber0Set swiper base height, unit px. (need when vertical, default height is swiper's height, but when you init a swiper with invisible, default height can not be set right, you need set base height in this time.)
baseSizeDomString、dom | Set swiper base width and height with a dom or a selector.(priority is lower than baseWidth and baseHeight)

Events

NameParametersDescription
slide-changeindex, oldIndexFire when the slide changed .
slide-endindexFire when the slide animation end .

License

MIT

Copyright (c) 2017-present, zhengjiaqi

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago