当前位置:网站首页>How to realize the drop-down option box of wechat applet
How to realize the drop-down option box of wechat applet
2022-07-25 08:56:00 【Yisu cloud】
How to realize the drop-down option box of wechat applet
This article mainly explains “ How to realize the drop-down option box of wechat applet ”, Interested friends might as well come and have a look . The method introduced in this paper is simple and fast , Practical . Now let Xiaobian take you to learn “ How to realize the drop-down option box of wechat applet ” Well !
design sketch

test.js
/** * Initial data of the page */ data: { shows: false, // Control the display and hiding of the drop-down list ,false hide 、true Show selectDatas: [' Consumer accounts ', ' Platform rebate account ', ' Wechat Wallet '], // Data from the drop-down list indexs: 0, // Selected drop-down column Table subscript , }, // Click the drop-down display box selectTaps() { this.setData({ shows: !this.data.shows, }); }, // Click on the drop-down list optionTaps(e) { let Indexs = e.currentTarget.dataset.index; // Get the subscript of the clicked drop-down list console.log(Indexs) this.setData({ indexs: Indexs, shows: !this.data.shows }); },test.wxml
<view class='fenlei'> <text> Address </text> <!-- A drop-down box --> <view class='select_box'> <view class='select' catchtap='selectTaps'> <text class='select_text'>{{selectDatas[indexs]}}</text> <!-- <image class='words_img' src='../../images/sanjiao.png'></image> --> <image class='select_img {{shows&&"select_img_rotate"}}' src='../../images/sanjiao.png'></image> </view> <view class='option_box' style='height:{{shows?(selectDatas.length>5?300:selectDatas.length*60):0}}rpx;'> <text class='option' style='{{indexs==selectDatas.length-1&&"border:0;"}}' wx:for='{{selectDatas}}' wx:key='this' data-index='{{index}}' catchtap='optionTaps'>{{item}}</text> </view> </view></view>test.wxss
/* fenlei */.fenlei{ margin: 0 25rpx; height: 90rpx; line-height: 90rpx; border-bottom: 1rpx solid #e6e6e6; display: flex; align-items: center;}.fenlei text{ font-size: 30rpx; color: #999999; margin-left: 15rpx;}/* A drop-down box */.select_box { background: #fff; width: 620rpx; /* margin: 0 auto; */ height: 90rpx; line-height: 90rpx; text-align: left; position: relative;}.select { box-sizing: border-box; width: 100%; height: 86rpx; /* border: 1px solid #efefef; */ border-radius: 8rpx; display: flex; align-items: center; padding: 0 20rpx;}.select_text { font-size: 28rpx; flex: 1; color: rgb(102, 102, 102); line-height: 86rpx; height: 86rpx;}.select_img { width: 40rpx; height: 40rpx; display: block; transition: transform 0.3s;}.select_img_rotate { transform: rotate(180deg);}.option_box { position: absolute; top: 86rpx; width: 100%; /* border: 1px solid #efefef; */ box-sizing: border-box; height: 0; overflow-y: auto; border-top: 0; background: #fff; transition: height 0.3s; z-index: 100;}.option { display: block; line-height: 40rpx; font-size: 28rpx; border-bottom: 1px solid #efefef; padding: 10rpx; color: rgb(102, 102, 102);}Here we are , I'm sure you're right “ How to realize the drop-down option box of wechat applet ” Have a deeper understanding of , You might as well put it into practice ! This is the Yisu cloud website , For more relevant contents, you can enter the relevant channels for inquiry , Pay attention to our , Continue to learn !
边栏推荐
- canvas动态图片头像晃动js特效
- 51 MCU peripherals: Motor
- Intel apologized to the winners of Xe HPG treasure hunt game for product delay and announced the appearance of the prize
- 富文本样式文字图片处理
- Dependency conflict resolution under idea
- How can hospitals achieve efficient and low-cost operation and maintenance? Is there any software that can meet it?
- JDBC快速入门
- The simplest sklearn environment configuration tutorial in the whole network (100% success)
- Redis learning notes
- 51单片机内部外设:串口通信
猜你喜欢

Intelligent operation and maintenance scenario analysis: how to detect abnormal business system status through exception detection

IDEA下依赖冲突解决方法

Tips for improving code sustainability, take connectto method as an example.

Wechat applet ordering system graduation design of applet completion works (8) graduation design thesis template

机器人跳跃问题

这是我见过写得最烂的Controller层代码...

Sticky.js page scrolling div fixed position plug-in

Phpexcel reports an error: err_ INVALID_ RESPONSE

为什么要使用MQ消息中间件?这几个问题必须拿下!
![[Development Tutorial 9] crazy shell · open source Bluetooth smart health watch - storage](/img/25/212712d919540763a6c339e1b5a50b.png)
[Development Tutorial 9] crazy shell · open source Bluetooth smart health watch - storage
随机推荐
附加:中半部分sql语句 区/县(数据表)
JDBC的api全解
游戏外挂怎么做?
table表格展开内部行切换效果
Oracle10g单实例数据库升级到哪个版本好,求建议
Force buckle - 1046. Weight of the last stone
51 single chip microcomputer controls nixie tube display
This is the worst controller layer code I've ever seen
JDBC的API解析
为什么说DAO是未来的公司形式
Mongodb database
Wechat reservation of the completed works of the applet graduation project (6) opening defense ppt
flink sql怎么持久化?
Phpexcel reports an error: err_ INVALID_ RESPONSE
【sklearn】sklearn.preprocessing.LabelEncoder
Wechat reservation applet graduation design of applet completion works (1) development outline
Solutions to ten questions of leetcode database
Graduation design of wechat small program ordering system of small program completion works (3) background function
Graduation project of wechat small program ordering system of small program completion works (1) development outline
智能运维场景解析:如何通过异常检测发现业务系统状态异常