This article mainly introduces the relevant codes for deletion processing of WeChat applet in detail. Using the modal box in the applet to achieve deletion has certain reference value. Interested friends can refer to it
How to achieve this effect without confrim?
You can use the modal box in the mini program
Code:
wxml:
<a class="reply" wx:if="{{comment.uid==comment.login_uid}}" bindtap="del" data-cid="{{comment.c_id}}">删除</a>
js:
del:function(e){ var that = this; wx.showModal({ title: '提示', content: '确定要删除吗?', success: function (sm) { if (sm.confirm) { // 用户点击了确定 可以调用删除方法了 wx.request({ url: 'https://m.*****.com/index.php/Home/Xiaoxxf/home_comment_del?c_id=' + e.currentTarget.dataset.cid, //删除房间评论 data: '', header: { 'Content-Type': 'application/json' }, method: 'GET', success: function (res) { console.log(res); wx.showToast({ title: res.data, //数据返回提示,查看后台PHP icon: 'success', duration: 2000 }) /* 获取房间评论信息 -xzz 0714*/ getList(that); }, fail: function (res) { }, complete: function (res) { }, }) } else if (sm.cancel) { } } }) }
Effect:
This achieves the confirm effect of js.
The above is the detailed content of A case of deletion processing of WeChat applet. For more information, please follow other related articles on the PHP Chinese website!