微信小程序广告banner、滚动屏怎么做?

使用滑块视图容器swiper和swiper-item可以制作滚动屏,代码如下:

wxml:

html 复制代码
<swiper indicator-dots indicator-color="rgba(255,255,255,0.5)" indicator-active-color="white" autoplay interval="3000">
   <swiper-item>
    <image src=""fakepath://展厅绘制.jpg"/>
  </swiper-item>
  <swiper-item>
    <image src=""fakepath://展会名片.jpg"/>
  </swiper-item>
  <swiper-item>
    <image src=""fakepath://签到.jpg" />
  </swiper-item>
  <swiper-item>
    <image src="fakepath://抽奖.jpg" />
  </swiper-item>
  <swiper-item>
    <image src="fakepath://礼品领取.jpg"/>
  </swiper-item>
</swiper>

wxss:

css 复制代码
swiper image{
  width: 100%;
  height: 100%;
}

效果如下:

其中,swiper常用参数如下,其中只可放置swiper-item组件,否则会导致未定义的行为。:

|------------------------|---------|-------------------|--------|---------------|
| 属性 | 类型 | 默认值 | 必填 | 说明 |
| indicator-dots | boolean | FALSE | 否 | 是否显示面板指示点 |
| indicator-color | color | rgba(0, 0, 0, .3) | 否 | 指示点颜色 |
| indicator-active-color | color | #000000 | 否 | 当前选中的指示点颜色 |
| autoplay | boolean | FALSE | 否 | 是否自动切换 |
| current | number | 0 | 否 | 当前所在滑块的 index |
| interval | number | 5000 | 否 | 自动切换时间间隔 |
| duration | number | 500 | 否 | 滑动动画时长 |

swiper使用细节可见官方文档:

视图容器 / swiper (qq.com)

微信小程序教程,欢迎关注我!

相关推荐
说私域8 分钟前
基于AI智能名片链动2+1模式服务预约小程序的旅拍消费需求激发路径研究
大数据·人工智能·小程序
小白学大数据2 小时前
某程旅行小程序爬虫技术解析与实战案例
爬虫·小程序
小小王app小程序开发2 小时前
家政服务小程序特殊玩法开发全解析:技术实现+架构支撑+合规落地
小程序·架构
游戏开发爱好者83 小时前
2025年iOS应用上架App Store全指南,开发者必看
android·ios·小程序·https·uni-app·iphone·webview
集成显卡3 小时前
CVE检索工具 | 开发一款检索漏洞信息的小程序
网络安全·小程序·uni-app·cve·漏洞信息
luffy54593 小时前
微信小程序实现图片横向滑动的示例
微信小程序·小程序
万岳软件开发小城3 小时前
直播电商系统源码搭建直播带货APP/小程序的完整流程
小程序·php·软件开发·直播带货系统源码·直播电商app开发
棒棒的唐4 小时前
使用微信小程序版Vant的upload组件上传身份证的样式自定义方案(Css魔改版)
css·微信小程序·小程序
jaqi.l4 小时前
uni-app 小程序全局挂载分享功能,并动态配置页面是否可以分享
vue.js·小程序·uni-app
2501_915106325 小时前
HBuilderX 项目上架 iOS app上架 App Store 的关键流程
android·ios·小程序·https·uni-app·iphone·webview