滑动删除单元格
data(){
return{
start:0,
move:0
}
}
<div class="cellwindow">
<div class="cellbg" @touchmove="touchmoves" @touchstart="touchstarts">
<div class="cell_content>
内容
</div>
<div class="cell_del>
删除
</div>
</div>
</div>
.cellwindow{
width:375px;
overflow:hidden;
}
.cell_content{
float:left;
width:375px;
}
.cell_del{
float:left;
width:50px;
}
touchstarts(e){
this.start=e.targetTouches[0].clientX || event.changedTouches[0].clientX
},
touchmoves(e){
this.move=e.targetTouches[0].clientX || event.changedTouches[0].clientX
if(this.start>this.move){
e.currentTarget.style.marginLeft='-50px'
}
else{
e.currentTarget.style.marginLeft='0px'
}
},