当前位置:网站首页>Implementation of side list menu (side menu) of wechat applet
Implementation of side list menu (side menu) of wechat applet
2022-07-24 16:36:00 【Chen Xiaoxiang who wants to fly】
Hello !
First map

Ideas :
. This side menu is actually very simple , The general layout is written first , Use the conditional rendering of applet ,
Hide it when you don't need to click , Just show it when you need to show it
wxml:
<view class="objectView">
<view class="btnShow" catchtap="show">show list </view>
</view>
<view class="cehuaDa" wx:if="{
{isShowSideslip}}">
<view class="sideslipMenuItemlist">
<block wx:for="{
{sideslipMenuArr}}">
<view class="sideslipMenuItem" id="{
{index}}" catchtap="itemClick">
{
{
item}}
</view>
</block>
</view>
<view class="sideslipMenu" catchtap="offSideslipMen">
</view>
</view>
js:
//data
isShowSideslip: false,
sideslipMenuArr: [' Hey ', ' ha-ha ', ' Ah ah ', ' All in all ', ' Make love ', ' Hey, hey, hey ', ' dadada ']
show: function() {
this.setData({
isShowSideslip: true
})
},
offSideslipMen: function(){
this.setData({
isShowSideslip: false
})
}
,
itemClick: function(e) {
var tapId = e.currentTarget.id;
var index = this;
for (var i = 0; i < index.data.sideslipMenuArr.length;i++){
if (tapId == i){
wx.showToast({
title: index.data.sideslipMenuArr[i],
icon: 'none',
image: '',
duration: 1000,
mask: true,
success: function(res) {
},
fail: function(res) {
},
complete: function(res) {
},
})
}
}
}
.wxss:
page{
width:100%;
height: 100%;
}
.objectView{
width: 100%;
height: 100%;
position: absolute;
}
.btnShow{
width: 100%;
height: 100%;
text-align: center;
line-height: 100vh
}
.cehuaDa {
width: 100%;
height: 100%;
position: relative;
z-index: 10;
}
.sideslipMenu {
background-color: black;
opacity: 0.6;
width: 100%;
height: 100%;
position: absolute;
z-index: 9;
}
.sideslipMenuItemlist {
width: 200rpx;
background-color: #454545;
opacity: 1;
position: absolute;
right: 0;
top: 0;
z-index: 10;
height: 100%;
display: flex;
flex-direction: column;
padding-top: 30rpx;
}
.sideslipMenuItem {
flex: 1;
text-align: center;
color: #fff;
font-size: 30rpx;
}
Code :
https://github.com/897589417/sideMenuList
I was dreaming , Thank you for watching my blog , If there is any mistake , Please feel free to contact me ,QQ:897589417
边栏推荐
- JS, call in the for loop is asynchronously converted to synchronous execution
- JUC源码学习笔记3——AQS等待队列和CyclicBarrier,BlockingQueue
- .net review the old and know the new: [6] what is LINQ
- GEO satellite data download
- Cross server, insert, search
- [leetcode]38. counting - problem solving (execution time beat 91%, memory consumption beat 97%)
- Telephone system rules
- Qt信号和槽连接失败原因及解决办法
- TCP protocol debugging tool tcpengine v1.3.0 tutorial
- Meizu blood exchange: Alibaba quits? Zhuhai SASAC joins the Bureau, and Huang Zhang hands over the controlling stake! Li Nan is removed from the main staff!
猜你喜欢

Envi5.3 open GF-1 WFV data
![Leetcode:162. looking for peak [two points looking for peak]](/img/77/64b7c9bf1aebc2a0ab82218ddfff62.png)
Leetcode:162. looking for peak [two points looking for peak]
![[Nanjing Agricultural University] information sharing of postgraduate entrance examination and re examination](/img/1d/550a991385b842a21e2b301725407e.png)
[Nanjing Agricultural University] information sharing of postgraduate entrance examination and re examination
[email protected]"/>ZBar project introduction and installation configuration| [email protected]

How vscode mouse wheel enlarges the interface

Simply use MySQL index

PS pull out logo

普林斯顿微积分读本02第一章--函数的复合、奇偶函数、函数图像

15、ARM嵌入式系统:如何用PC调试单板

剑指 Offer 48. 最长不含重复字符的子字符串
随机推荐
[technology] chat room demo of uniapp
详解 Apache Hudi Schema Evolution(模式演进)
More than 40 Qualcomm chips have been exposed to security vulnerabilities, affecting billions of mobile phones!
Telephone system rules
With regard to performance testing, dry goods hit "suggestions collection"
Win10 download address
PS pull out logo
EventLoop event loop mechanism
To create a private Ca, I use OpenSSL
【技术】uniapp 之 在线选座 demo
Quickly view the version of redis in the server
js,for循环内callback异步转换成同步执行
Cache penetration, cache breakdown, cache avalanche differences and solutions [easy to understand]
What does Baidu promote "delete and recall" mean?
[technology] online seat selection demo of uniapp
Codeforces round 690 (Div. 3) C. unique number conventional solution
Codeforces round 690 (Div. 3) B. last year's substring conventional solution
[leetcode]38. counting - problem solving (execution time beat 91%, memory consumption beat 97%)
2019q1 global smartphone shipments: Huawei vivo increased significantly, while Apple plummeted 30.2%!
Replace the image source of Debian full version with Alibaba cloud image source