当前位置:网站首页>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%);
}
}
边栏推荐
- How to write vite plug-ins
- Face registration, unlock, respond, catch all
- How to correctly calculate the number of rows imported into EXCEL (poi/npoi)
- Hexiaopeng: if you can go back to starting a business, you won't name the product in your own name
- 面向 PyTorch* 的英特尔 扩展助力加速 PyTorch
- Basic data types of C language and their printouts
- C语言的基本数据类型及其打印输出
- 20000 words + 30 pictures | MySQL log: what is the use of undo log, redo log and binlog?
- kubernetes日志监控系统架构详解
- 实战监听Eureka client的缓存更新
猜你喜欢

Flex attribute of wechat applet

微信小程序之从底部弹出可选菜单

如何正确计算导入Excel的行数(POI/NPOI)

Androd Gradle模块依赖替换如何使用

Linear regression analysis of parent-child height data set

Quarkus+saas multi tenant dynamic data source switching is simple and perfect

In depth analysis of mobilenet and its variants

Input adjustment of wechat applet

利用XtraDiagram.DiagramControl进行流程图形的绘制和控制

Use xtradiagram Diagramcontrol for drawing and controlling process graphics
随机推荐
Getting started with reverse debugging - learn about PE structure files
One way linked list implementation -- counting
有向图D和E
AI reference kit
How did Tencent's technology bulls complete the overall cloud launch?
白皮书丨英特尔携手知名RISC-V工具提供商Ashling,着力扩展多平台RISC-V支持
【无标题】
Quarkus+saas multi tenant dynamic data source switching is simple and perfect
64 channel telephone +2-channel Gigabit Ethernet 64 channel PCM telephone optical transceiver voice telephone to optical fiber
怎么手写vite插件
Actual combat | how to make a slam track truth acquisition device?
串口、COM、UART、TTL、RS232(485)区别详解
Oracle进入sqlplus 报错
[Course preview] AI meter industry solution based on propeller and openvino | industrial meter reading and character detection
Intel ® extensions for pytorch* accelerate pytorch
Best practices for auto plug-ins and automatic batch processing in openvinotm 2022.1
Loss, duplication and backlog of message queues
Basic data types of C language and their printouts
You call this shit MQ?
Scope of groovy