当前位置:网站首页>微信小程序轮播图怎么自定义光标位置
微信小程序轮播图怎么自定义光标位置
2022-06-24 18:50:00 【亿速云】
微信小程序轮播图怎么自定义光标位置
本篇内容介绍了“微信小程序轮播图怎么自定义光标位置”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
如图

轮播图的光标可以用定位来改变上下左右的位置
wxml:
<!--start banner --><swiper class='home-swiper' autoplay='true' bindchange='changDot' interval='4000'> <!-- 设置自动播放,切换间隔时间--> <swiper-item wx:for="{{slider}}" wx:for-index="index" wx:key="slider"> <image src='{{item.img}}'></image> </swiper-item></swiper><!-- 轮播图光标 --><view class="dots"> <block wx:for="{{slider}}" wx:key="slider"> <view class="dot {{index == swiperCurrent?'actives':''}}"></view> </block></view><!-- end banner -->wxss:
/* 轮播图图片尺寸 */ .home-swiper { width: 100%; height: 350rpx; position: relative;} .home-swiper image { width: 100%; height: 100%;} /* 轮播图指示点 */ .dots { display: flex; flex-direction: row; position: absolute; top: 311rpx; width: 100%; height: 50rpx; justify-content: center;} .dots .dot { width: 20rpx; height: 20rpx; /* background-color: #333; */ /* border: 1rpx solid #e8672e; */ margin-left: 12rpx; background: #fff; border-radius: 20rpx; /* transform: all 0.6; */ opacity: 0.44;} /* 调用的css效果 */ .dots .actives { background-color: #fff; opacity: 1;}js:
Page({ /** * 页面的初始数据 */ data: { swiperCurrent: 0, slider :[ {'img':'/img/img/1.jpg'}, { 'img': '/img/img/1.jpg' }, { 'img': '/img/img/1.jpg' }, { 'img': '/img/img/1.jpg' }, { 'img': '/img/img/1.jpg' } ] }, // 轮播图下标 changDot(e) { this.setData({ swiperCurrent: e.detail.current }); }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function() { }, /** * 生命周期函数--监听页面显示 */ onShow: function() { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function() { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function() { }, /** * 用户点击右上角分享 */ onShareAppMessage: function() { }})“微信小程序轮播图怎么自定义光标位置”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!
边栏推荐
- Introduction and tutorial of SAS planet software
- Do you have all the basic embedded knowledge points that novices often ignore?
- Air pollution gas satellite data download tutorial
- ArrayList源码解析
- Volcano devient l'ordonnanceur de lots par défaut Spark
- Value passing and reference passing of value types and reference types in CSharp
- History object
- Volcano becomes spark default batch scheduler
- Microsoft planetary computer (MPC) platform introduction, registration and comparison
- JS position operation
猜你喜欢

Location object

How to use Fisher's least significant difference (LSD) in R

The sharp sword of API management -- eolink

Value passing and reference passing of value types and reference types in CSharp

DOM (document object model)

ArrayList源码解析

LabView之MQTT协议使用

Volcano成Spark默认batch调度器

TKDE2022:基于知识增强采样的对话推荐系统

R语言 4.1.0软件安装包和安装教程
随机推荐
Sr-gnn shift robot gnns: overlapping the limitations of localized graph training data
論文解讀(SR-GNN)《Shift-Robust GNNs: Overcoming the Limitations of Localized Graph Training Data》
多云模式并非“万能钥匙”
How to perform power regression in R
Sentry series satellite introduction and download tutorial
Learn routing and data delivery
subject may not be empty [subject-empty]
Remote sensing Forum
Freeswitch uses origin to dialplan
next_ Permutation full permutation function
okcc呼叫中心数据操作的效率问题
Conception de systèmes de micro - services - construction de sous - services
Microservice system design - sub service project construction
three.js创建的基础框架
微服務系統設計——子服務項目構建
Eight digit
上位机与MES对接的几种方式
PLC功能块系列之多段曲线控温FB(SCL程序)
Development of NFT dual currency pledge liquidity mining system
BSS应用程序云原生部署的8大挑战