当前位置:网站首页>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%);
}
}
边栏推荐
- 在線文本過濾小於指定長度工具
- Use openvinotm preprocessing API to further improve the reasoning performance of yolov5
- Develop a powerful tool for increasing efficiency - vscode plug-in sharing in 2022
- 栈和队列的基本使用
- Windows install MySQL
- Overview of national parks in the United States
- What does it mean for AI developers after 2022
- 串口、COM、UART、TTL、RS232(485)区别详解
- 【深入理解TcaplusDB技术】 Tmonitor模块架构
- Simplify deployment with openvino model server and tensorflow serving
猜你喜欢

实战监听Eureka client的缓存更新

Oracle进入sqlplus 报错
![[Course preview] AI meter industry solution based on propeller and openvino | industrial meter reading and character detection](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[Course preview] AI meter industry solution based on propeller and openvino | industrial meter reading and character detection

深入剖析MobileNet和它的变种

怎么手写vite插件

#yyds干货盘点# 解决剑指offer: 判断是不是平衡二叉树

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

White paper - Intel and Ashling, a well-known risc-v tool provider, strive to expand multi platform risc-v support

Linear regression analysis of parent-child height data set

Go write file permission WriteFile (filename, data, 0644)?
随机推荐
【深入理解TcaplusDB技术】 Tmonitor模块架构
OpenVINOTM 2022.1中AUTO插件和自动批处理的最佳实践
Filtre de texte en ligne inférieur à l'outil de longueur spécifiée
Is it safe for flush to open an account online? What should we pay attention to
Pyqt5 designer making tables
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 ~
Oracle进入sqlplus 报错
Modelsim 安装步骤详解
Js: get the maximum zindex (Z-index) value of the page
火绒安全与英特尔vPro平台合作 共筑软硬件协同安全新格局
Simplify deployment with openvino model server and tensorflow serving
Proofs of Elsevier Elsevier Journal (Neptune Neptune) (problems encountered: latex remove the chapter number)
【课程预告】基于飞桨和OpenVINO 的AI表计产业解决方案 | 工业读表与字符检测
How to write vite plug-ins
How did Tencent's technology bulls complete the overall cloud launch?
Quartus II 13.1 detailed installation steps
Develop a powerful tool for increasing efficiency - vscode plug-in sharing in 2022
First exposure! The only Alibaba cloud native security panorama behind the highest level in the whole domain
4-way telephone +1-way Gigabit Ethernet 4-way PCM telephone optical transceiver
Common usage of OS (picture example)