当前位置:网站首页>Wechat applet realizes left sliding deletion
Wechat applet realizes left sliding deletion
2022-06-28 21:54:00 【One piece for correspondence students】
wxml Code :
<view class="global">
<movable-area class="area">
<movable-view bindtouchstart="start" bindtouchend="end" class="view" direction="horizontal" x="{
{isopen?'-120rpx':'0'}}">
Slide left to delete
</movable-view>
</movable-area>
<button type="warn" class="btn"> Delete </button>
</view> wxss Code :
.global{
height: 130rpx;
/* width: 100%; */
background-color: orange;
margin: 30px 0;
display:flex;
}
.btn{
/* height: 130rpx; */
width: 120rpx;
font-size: 28rpx;
/* margin-top: 30px; */
line-height: 5;
}
.area{
height: 100%;
/* width: 100% */
flex: 1;
background-color: orchid;
}
.view{
height: 130rpx;
/* width: 750rpx; */
width: 100vw; /* Screen width */
z-index: 99999; /* With higher stacking order , Cover on button */
background-color: palegreen;
}js Code :
let Xtouchstart=0 /* Define a global variable , Used to define the initial position */
Page({
start:function(evt){
Xtouchstart= evt.changedTouches[0].pageX /* The position of the starting point */
// console.log(Xtouchstart)
},
end:function(evt){
let Xtouchend=evt.changedTouches[0].pageX /* The position of the end point */
let Xtouchdiffer=Xtouchend-Xtouchstart /* Difference value , The difference is the relative difference , So it doesn't matter where you pull it */
console.log(Xtouchdiffer)
// if(Xtouchdiffer<-30){
// this.setData({
// isopen:true
// })
// }
if(Xtouchdiffer>-20&&Xtouchdiffer<0){
this.setData({
isopen:false
})
}
else if(Xtouchdiffer<20&&Xtouchdiffer>0){
this.setData({
isopen:true
})
}
else if(Xtouchdiffer<-20){
this.setData({
isopen:true
})
}
else{
this.setData({
isopen:false
})
}
},
/**
* Initial data of the page
*/
data: {
isopen:false
},effect :

边栏推荐
- 力扣树的进一步应用
- LeetCode226. Flip binary tree
- Definition and precautions of genuine St link/v2 j-link jtag/swd pin
- Survival of beaver: post-90s female doctors and AI developers
- Progress in visual weakly supervised learning
- Lua source code analysis: 1 Lua variable type mutability is implemented in C code.
- How can the sports app keep the end-to-side background alive to make the sports record more complete?
- [webapi] return dynamic list dynamic
- LeetCode986. Intersection of interval lists
- Understanding of incomplete types
猜你喜欢
![[Note: circuit intégré MOS analogique] référence de bande Gap (principe de base + mode courant + circuit en mode tension)](/img/cd/be62272d465ca990456c222b38df67.png)
[Note: circuit intégré MOS analogique] référence de bande Gap (principe de base + mode courant + circuit en mode tension)

Leetcode daily question - 515 Find the maximum value in each tree row

力扣树的进一步应用
![Sword finger offer:[day 2 linked list (simple)] --- > print the linked list from end to end](/img/d6/824985b74b27a1bee456c2cebbac26.jpg)
Sword finger offer:[day 2 linked list (simple)] --- > print the linked list from end to end

Ehcache configuration data, convenient for self checking

Survival of beaver: post-90s female doctors and AI developers
![Sword finger offer:[day 2 linked list (simple)] --- > reverse linked list](/img/05/0d7ed95f83c2188d274dde84817dc3.jpg)
Sword finger offer:[day 2 linked list (simple)] --- > reverse linked list

PHP uses stack to solve maze problem

Progress in visual weakly supervised learning

Pie (poj3122) super detailed and easy to understand binary introduction
随机推荐
LeetCode986. 区间列表的交集
在哪个软件上开户比较安全,开户流程是什么?
Bitbucket 使用 SSH 拉取仓库失败的问题
PHP login problem
Why use the rust language?
为什么要使用 Rust 语言?
LeetCode877. 石子游戏
接口用例设计
LeetCode122. The best time to buy and sell stocks II
华为云的AI深潜之旅
QStringLiteral(str)
LeetCode560. 和为K的子数组
Leetcode daily question - 522 Longest special sequence II
QT how the coordinates of one control are relatively fixed and displayed on another control (coordinate system)
LeetCode117. 填充每个节点的下一个右侧节点指针_II
Recommend two high-quality Wallpaper software
Study on bifunctional crosslinker lumiprobe sulfoacyanine 7 dicarboxylic acid
Workplace tips | understanding the advantages of the position "knowing people"
【激活函数】
Lumiprobe proteorange protein gel dye instructions