Home  >  Article  >  WeChat Applet  >  A case of deletion processing of WeChat applet

A case of deletion processing of WeChat applet

黄舟
黄舟Original
2017-09-12 10:26:063371browse

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: &#39;提示&#39;,
  content: &#39;确定要删除吗?&#39;,
  success: function (sm) {
   if (sm.confirm) {
   // 用户点击了确定 可以调用删除方法了
   wx.request({
    url: &#39;https://m.*****.com/index.php/Home/Xiaoxxf/home_comment_del?c_id=&#39; + e.currentTarget.dataset.cid, //删除房间评论
    data: &#39;&#39;,
    header: {
    &#39;Content-Type&#39;: &#39;application/json&#39;
    },
    method: &#39;GET&#39;,
    success: function (res) {
    console.log(res);
    wx.showToast({
     title: res.data, //数据返回提示,查看后台PHP
     icon: &#39;success&#39;,
     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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn