首页 >> js开发 >> js微信小程序轮播图swiper代码详解js大全
js微信小程序轮播图swiper代码详解js大全
发布时间: 2021年1月13日 | 浏览:
| 分类:js开发
微信小程序自定义swiper微信小程序自定义swiper滑块视图容器。其中只可放置swiper-item组件,否则会导致未定义的行为。
先在index.wxml中写style=“background:{{item}}” 报错不要管,不影响页面布局style=“background:{{item}}” 报错不要管,不影响页面布局
indicator-dots="{{indicatorDots}}" 是否显示面板指示点
autoplay="{{autoplay}}" 是否自动切换
interval="{{interval}}" 自动切换时间间隔
duration="{{duration}}" 滑动动画时长
circular="{{circular}}" 是否采用衔接滑动
indicator-active-color="#ff0099" 选中指示点颜色
>
循环遍历数据
indicator-dots="{{indicatorDots}}" 是否显示面板指示点
autoplay="{{autoplay}}" 是否自动切换
interval="{{interval}}" 自动切换时间间隔
duration="{{duration}}" 滑动动画时长
circular="{{circular}}" 是否采用衔接滑动
indicator-active-color="#ff0099" 选中指示点颜色
>
循环遍历数据
再在index.js中写
Page({
data: {
background: ["red", "pink","yellowgreen"],
indicatorDots: true,
vertical: false,
autoplay: true,
interval: 2000,
duration: 500,
circular:true
}
})
Page({
data: {
background: ["red", "pink","yellowgreen"],
indicatorDots: true,
vertical: false,
autoplay: true,
interval: 2000,
duration: 500,
circular:true
}
})
最后在index.wxss中写
.swiper1{
width: 100%;
height: 200px;
}
.swiper-item{
width: 100%;
height: 100%;
}
.swiper1{
width: 100%;
height: 200px;
}
.swiper-item{
width: 100%;
height: 100%;
}
记住:记住:图片跟背景颜色思路一样
先在index.wxml中写style=“background:{{item}}” 报错不要管,不影响页面布局style=“background:{{item}}” 报错不要管,不影响页面布局
autoplay="{{autoplay}}" 是否自动切换
interval="{{interval}}" 自动切换时间间隔
duration="{{duration}}" 滑动动画时长
circular="{{circular}}" 是否采用衔接滑动
indicator-active-color="#ff0099" 选中指示点颜色
>
autoplay="{{autoplay}}" 是否自动切换
interval="{{interval}}" 自动切换时间间隔
duration="{{duration}}" 滑动动画时长
circular="{{circular}}" 是否采用衔接滑动
indicator-active-color="#ff0099" 选中指示点颜色
>
再在index.js中写
Page({
data: {
background: ["red", "pink","yellowgreen"],
indicatorDots: true,
vertical: false,
autoplay: true,
interval: 2000,
duration: 500,
circular:true
}
})
Page({
data: {
background: ["red", "pink","yellowgreen"],
indicatorDots: true,
vertical: false,
autoplay: true,
interval: 2000,
duration: 500,
circular:true
}
})
最后在index.wxss中写
.swiper1{
width: 100%;
height: 200px;
}
.swiper-item{
width: 100%;
height: 100%;
}
.swiper1{
width: 100%;
height: 200px;
}
.swiper-item{
width: 100%;
height: 100%;
}
记住:记住:图片跟背景颜色思路一样
相关文章:
- js简单谈谈offsetleft、offsetTop和offsetParentjs大全
- jsvue基于Echarts的拖拽数据可视化功能实现js大全
- jselement-ui中el-upload多文件一次性上传的实现js大全
- js代码JavaScript中条件语句的优化技巧总结
- jsaddEventListener()和removeEventListener()追加事件和删除追加事件js大全
- JavaScriptjs调用网络摄像头的方法
- JavaScript10分钟学会js处理json的常用方法
- js代码JavaScript实现浏览器网页自动滚动并点击的示例代码
- js小程序角标的添加及绑定购物车数量进行实时更新的实现代码js大全
- jsvue表单验证之禁止input输入框输入空格js大全