当前位置:网站首页>Drop down menu scenario of wechat applet
Drop down menu scenario of wechat applet
2022-06-23 13:55:00 【qq_ forty-five million nine hundred and eleven thousand five hu】
design sketch :

app.wxss file
.title{
display:flex;
flex-direction: row;
margin:50rpx;
justify-content: center;
}
js file
Page({
data:{
li:[' Default sort ',' It's closest to me ',' Lowest price ',' Highest price '],
shownavindex:0
},
// Drop down events
listmenu: function(e) {
if (this.data.openif) {
this.setData({
openif: false,
shownavindex: 0
})
} else {
this.setData({
content: this.data.li,
openif: true,
shownavindex: e.currentTarget.dataset.nav
})
}
}
})
wxml file
<view class="title">2. Drop down menu scenario small case </view>
<view class="page">
<!-- Navigation content -->
<view class="nav">
<view class="nav-item {
{shownavindex == 1? 'active' : ''}}" bindtap="listmenu" data-nav="1">
<view class="content"> Sort </view>
<view class="icon"></view>
</view>
<view class="nav-item">
<view class="content"> Time </view>
<vew class="icon"></vew>
</view>
<view class="nav-item">
<view class="content"> Price </view>
<vew class="icon"></vew>
</view>
</view>
<!-- Drop down content -->
<view class="list {
{openif ? 'down' : 'up'}} ">
<view wx:for="{
{content}}">
{
{
item}}
</view>
</view>
</view>
josn file
{
"usingComponents": {
}
}
wxss file
.page{
overflow: hidden; /* Page overflow hidden */
}
.nav{
position: relative;
z-index: 1; /* Who covers the page elements */
display: flex;
flex-direction: row;
background: white;
}
.nav-item{
display: flex;
flex: 1; /* Several contents are equally divided into screens */
text-align: center;
height: 90rpx;
align-items: center;
justify-content: center;
font-size: 30rpx;
border: 1px solid gray;
}
.icon{
border: 10rpx solid transparent;
border-top: 10rpx solid gray;
margin-left: 12rpx;
}
.list{
display: none; /* Not shown at first , So show none*/
width: 100%;
/*overflow-y: scroll;*/
padding: 0 0 0 20rpx;
line-height: 100rpx;
background: white;
}
.list view{
border-bottom: 1px solid gray;
font-size: 32rpx;
}
.nav-item.active .content{
/* Notice that there are spaces */
color: skyblue;
}
.nav-item.active .icon{
border-bottom: 10rpx solid skyblue;
border-top: 0;
}
.down{
display: block;
animation: slidown 0.001s ease-in both; /* Add animation */
}
@keyframes slidown{
from{
transform: translateY(-100%);
}
to{
transform: translateY(0%);
}
}
.up{
display: block;
animation: slidup 0.001s ease-in both;
}
@keyframes slidup{
from{
transform: translateY(0%);
}
to{
transform: translateY(-100%);
}
}
边栏推荐
- Strengthen the sense of responsibility and bottom line thinking to build a "safety dike" for flood fighting and rescue
- Filtre de texte en ligne inférieur à l'outil de longueur spécifiée
- Tencent cloud tdsql-c heavy upgrade, leading the cloud native database market in terms of performance
- 串口、COM、UART、TTL、RS232(485)区别详解
- 4-way telephone +1-way Gigabit Ethernet 4-way PCM telephone optical transceiver
- Getting started with reverse debugging - learn about PE structure files
- [Course preview] AI meter industry solution based on propeller and openvino | industrial meter reading and character detection
- Oracle中dbms_output.put_line怎么使用
- 微信小程序之input调整
- What a talented company that can turn SAP system into a chicken rib!
猜你喜欢

构建英特尔 DevCloud

Quickly understand the commonly used asymmetric encryption algorithm, and no longer have to worry about the interviewer's thorough inquiry

Digraph D and e

The way out after the development of Internet technology -- the birth of IVX

【深入理解TcaplusDB技术】Tmonitor系统升级

Edge and IOT academic resources

PHP receiving and sending data

20000 words + 30 pictures | MySQL log: what is the use of undo log, redo log and binlog?

前AMD芯片架构师吐槽,取消 K12 处理器项目是因为 AMD 怂了!

【深入理解TcaplusDB技术】 Tmonitor模块架构
随机推荐
Has aaig really awakened its AI personality after reading the global June issue (Part 1)? Which segment of NLP has the most social value? Get new ideas and inspiration ~
Flex attribute of wechat applet
Quarkus+saas multi tenant dynamic data source switching is simple and perfect
【深入理解TcaplusDB技术】Tmonitor后台一键安装
利用XtraDiagram.DiagramControl进行流程图形的绘制和控制
What does it mean for AI developers after 2022
Tinder security cooperates with Intel vPro platform to build a new pattern of software and hardware collaborative security
Acquisition of wechat applet JSON for PHP background database transformation
白皮书丨英特尔携手知名RISC-V工具提供商Ashling,着力扩展多平台RISC-V支持
How to use sed -i command
sed -i命令怎么使用
Oracle进入sqlplus 报错
ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked.
边缘和物联网学术资源
使用OpenVINOTM预处理API进一步提升YOLOv5推理性能
kubernetes日志监控系统架构详解
构建英特尔 DevCloud
Use xtradiagram Diagramcontrol for drawing and controlling process graphics
Runtime application self-protection (rasp): self-cultivation of application security
White paper - Intel and Ashling, a well-known risc-v tool provider, strive to expand multi platform risc-v support