当前位置:网站首页>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
边栏推荐
- 普林斯顿微积分读本02第一章--函数的复合、奇偶函数、函数图像
- “天上天下,唯我独尊”——单例模式
- Complete guide on how to prevent cross site scripting (XSS) attacks
- 剑指 Offer 25. 合并两个排序的链表
- 百度推广“删除重提”是什么意思?
- 1184. 公交站间的距离
- Educational codeforces round 100 (rated for Div. 2) B. find the array solution
- QT keyboard event (II) -- long press the key to trigger the event event repeatedly, and the problem is solved
- 'resultmap'must match' (constructor?, id*, result*, association*, collect problem solving
- thinkphp3.2.5无法跳转到外部链接
猜你喜欢

EF LINQ Miscellany

Mobile phone comparison redmi note8 and realm x2
![[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

Envi SHP to ROI and mask the grid

Win10 download address

thinkphp3.2.5无法跳转到外部链接

Using native JS to realize magnifying glass function

Template method mode

How to prevent XSS in PHP

15. ARM embedded system: how to debug single board with PC
随机推荐
After data management, the quality is still poor
MODIS 16 day data monthly / quarterly synthesis
剑指 Offer 25. 合并两个排序的链表
图片浏览器?Qt也可以实现!
My first blog
[technology] online seat selection demo of uniapp
简单工厂模式都不会,你真应该去工厂搬砖!
Jia Yueting's Faraday will receive another financing of US $225million in the future, and ff91 will be mass produced soon!
Software recommendation - Installation
Qualcomm reconciled with apple and received at least $4.5 billion in settlement fees! Next goal: Huawei!
Wentai technology's revenue in the first quarter soared by 184.6% year-on-year, and its net profit soared by 256.21%!
regular expression
文件浏览器?Qt也可以实现!
会议OA项目进度(一)
ARP 入门
EF data migration
1184. 公交站间的距离
.net review the old and know the new: [6] what is LINQ
简易版QQ?Qt也可以实现!(一)
[leetcode]75. color classification - problem solving (execution time beat 90%, memory consumption beat 78%)