1 Star 0 Fork 0

KevyTian / kevy-swiper

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

kevy-swiper

介绍

轮播图插件,最多只显示3个,其余在循环切换时显示,具有3d切换效果,支持自动播放和设置时间间隔,切换后返回当前下标,默认监听左右滑动进行切换,想要上下滑动的话可以在插件里上下滑动的事件里写自己的逻辑。

软件架构

uniapp框架插件,欢迎下载使用。

方法和属性

名称 类型 描述
list Array swiper图片URL的list
listDesc Array 每个图片的说明文字列表,与list顺序一致,不传则不显示说明文字(即仅图片)
width Number swiper的宽度,单位rpx,默认100%
height Number swiper的高度,单位rpx,默认690rpx
click Func 点击当前item事件,返回当前item对应下标
change Func 切换后change事件,返回当前中间位置item对应下标
autoPlay Boolean 是否自动播放,true自动播放,默认为false
autoPlayInterval Number 自动播放时间间隔,autoPlay为true时生效,单位毫秒

使用说明

<template>
    <view class="t-content">
        <kevy-swiper v-if="list && list.length>0" @click="swClick" @change="swChange" :autoPlay="true" :autoPlayInterval="5000" :list="list" :listDesc="listDesc" :height="500" />
    </view>
</template>

<script>
    import kevySwiper from '@/components/kevy-swiper/kevy-swiper'
    export default {
        components: {
            kevySwiper
        },
        data() {
            return {
				//图片url列表
                list: [],
				//每个图片的说明文字列表,与list顺序一致,不传则不显示说明文字(即仅图片)
				listDesc:[],
            }
        },
		onLoad(){
			//请求数据
			//这里模拟请求到了这个list
			let list = ['https://shopimg.jetour.com.cn//cms/20230310/1678430865438.jpg',
			    'https://shopimg.jetour.com.cn//cms/20230311/1678499552265.png',
			    'https://shopimg.jetour.com.cn//cms/20230304/1677917344334.jpg', 
			    'https://shopimg.jetour.com.cn//cms/20230304/1677913372338.jpg',
			    'https://shopimg.jetour.com.cn//cms/20230217/1676613436640.jpg',
			    'https://shopimg.jetour.com.cn//cms/20230209/1675909568212.jpg'
			];
			//下面是图片说明列表,需要和上面下标对应
			let listDesc = ['我是第一个图片的说明文字','我是第二个图片的说明文字,我有点长省略号出现','我是第三个图片的说明文字','我是第四个图片的说明文字','我是第五个图片的说明文字','我是第六个图片的说明文字'];
			this.list = list;
			this.listDesc = listDesc;
		},
        methods: {
			//当点击图片时返回图片下标,用于跳转之类业务
            swClick(idx) {
				console.log("当前点击的图片下标为:"+idx)
            },
			//当切换后返回当前下标
			swChange(idx){
				console.log("当前中间图片的下标为:"+idx)
			}
        }
    }
</script>

<style lang="scss" scoped>
    .t-content {
        background-color: #f7f7f7;
        min-height: 100vh;
    }
</style>

空文件

简介

小程序轮播图插件,最多只显示3个,循环切换,具有3d样式效果 展开 收起
Vue
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/tiankf/kevy-swiper.git
git@gitee.com:tiankf/kevy-swiper.git
tiankf
kevy-swiper
kevy-swiper
master

搜索帮助