当前位置:网站首页>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 !
边栏推荐
- Django4.0 + web + MySQL 5.7 realize simple login operation
- canvas很多圆圈组成的文本js特效
- 【无标题】
- Solutions to ten questions of leetcode database
- 提高代码可续性的小技巧,以connectTo方法为例。
- Practice of establishing dynamic programming state transition equation
- 酷炫canvas动画冲击波js特效
- Graduation project of wechat small program ordering system of small program completion works (7) Interim inspection report
- Graduation design of wechat small program ordering system of small program completion works (3) background function
- 机器人跳跃问题
猜你喜欢

51 MCU peripherals: buzzer

The fifth day of MATLAB learning (cycle type)

Wechat reservation applet graduation design of applet completion works (1) development outline

本周大新闻|FCC曝光Pico 4 VR一体机,雷朋母公司建立智能眼镜实验室

Redis学习笔记

sticksy.js页面滚动div固定位置插件

How to connect tdengine with idea database tool?

Yolov5 environment configuration

2022-7-14 JMeter pressure test

Foundation 31: Selenium positioning dynamic ID element
随机推荐
Collection of common algorithm questions in test post interview
Algorithm --- flip digit (kotlin)
Asp. Net core CMD common instructions
Wechat reservation of the completed works of the applet graduation project (6) opening defense ppt
51 MCU internal peripherals: serial port communication
Basis 33: XPath acquisition methods of page elements under various browsers
JS touch screen game source code ice and snow journey
When crontab scheduled task executes jar through script, it encounters a pit where jar package execution is invalid
unity客户端读取文本配置
富文本样式文字图片处理
js小游戏源码魔塔闯关下载
JMeter test plan cannot be saved solution
附加:下半部分sql语句 区/县(数据表)
Read and write models and organize notes
uniapp中scroll-view的坑
LeetCode·83双周赛·6129.全0子数组的数目·数学
Wechat sports ground reservation applet graduation design of applet completion works (3) background function
Arcgis10.2 installation tutorial
Wechat sports ground reservation applet graduation project of applet completion works (1) development outline
flink sql怎么持久化?