uniapp
1.uniapp中长按事件,长按删除
longtap
- template部分
<view @longtap="onLongPress(item.commentId)" //绑定长按事件,传入所选ID
...
</view>
- script部分 k
// 长按删除
onLongPress(e) {
uni.showModal({ // 弹框询问是否进行下一步事件
title: '提示',
content: '是否删除该评论',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
uni.$http.delete(`//ym_server/comment/oneComment/${e}`).then((res) => {
this.commentContent()
})
} else if (res.cancel) {
console.log('用户点击取消');
return
}
}
});
},