更新记录
1.0.0(2021-12-06) 下载此版本
可横向左右无缝滑动、无缝轮播自定义swiper
平台兼容性
uni-app
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | - | √ | √ | √ | - | - | - | - |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
- | - | - | - | - | - | - | - | - | - | - |
其他
多语言 | 暗黑模式 | 宽屏模式 |
---|---|---|
× | × | √ |
先引入并注册组件
import customSwiper from '@/components/zhl-custom-swiper/zhl-custom-swiper.vue';
export default {
复制代码components: {
customSwiper
},
data() {
return {
/* 数据列表格式 */
list: [{
src: 'http://test.com/xx01.png', //完整的图片访问地址
},{
src: 'http://test.com/xx02.png',
}],
}
},
methods: {
/* 点击轮播banner的回调 */
clickBanner(obj) {
console.log(obj, 'obj', obj.src)
},
}
}
可传属性参数说明
list: 数据源列表,Array
height: 高度,单位rpx Number
autoPlay: 是否自动轮播 Boolean
indicator-dots: 是否显示面板指示点 Boolean
interval: 自动切换时间间隔 Number
clickItem: 点击轮播项的回调,参数为当前数据列表list对应的元素项
current: 默认先展示第几项数据 Number
template调用示例
<customSwiper class="my-customSwiper" :list="list" :height="356" :autoPlay="true" :indicator-dots="true" :interval="2000" @clickItem="clickBanner">