当前位置:网站首页>微信小程序轮播图怎么自定义光标位置
微信小程序轮播图怎么自定义光标位置
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() { }})“微信小程序轮播图怎么自定义光标位置”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!
边栏推荐
- Stored procedures in sqlserver
- NOKOV动作捕捉系统使多场协同无人机自主建造成为可能
- Buddha bless you that there will never be a bug
- JS pre parsing
- Why are life science enterprises on the cloud in succession?
- In depth learning of movement methods
- How to create a linear model prediction interval in R and visualize it
- MySQL basic commands
- 论文解读(SR-GNN)《Shift-Robust GNNs: Overcoming the Limitations of Localized Graph Training Data》
- Mqtt protocol usage of LabVIEW
猜你喜欢

Why are life science enterprises on the cloud in succession?

The sharp sword of API management -- eolink
![[leetcode] rotation series (array, matrix, linked list, function, string)](/img/9e/079311df16fa8e28708f4e050e531f.png)
[leetcode] rotation series (array, matrix, linked list, function, string)

时间溯源的系统设计思路

JS local storage

为什么生命科学企业都在陆续上云?

okcc呼叫中心数据操作的效率问题

starring开发HttpJson接入点+数据库

High dimension low code: component rendering sub component

Volcano becomes spark default batch scheduler
随机推荐
一文理解OpenStack网络
Executing SQL statements with parameterized commands
Set up your own website (8)
Microservice system design -- data model and system architecture design
Air pollution gas satellite data download tutorial
Sr-gnn shift robot gnns: overlapping the limitations of localized graph training data
Eight digit
How to create a linear model prediction interval in R and visualize it
初步学习Nuxt3
three.js创建的基础框架
Application scenarios of channel of go question bank · 11
网络安全审查办公室对知网启动网络安全审查
上位机与MES对接的几种方式
JS picture switching case
Introduction, download and use of global meteorological data CRU ts from 1901 to 2020
Introduction and tutorial of SAS planet software
Development of NFT dual currency pledge liquidity mining system
Using alicloud RDS for SQL Server Performance insight to optimize database load - first understanding of performance insight
Navigator object
Multi segment curve temperature control FB (SCL program) of PLC function block series