微信小程序删除处理

作者: 第九程序官方 | 来源:发表于2017-07-21 10:33 被阅读34次

    微信小程序开发之小程序删除处理步骤教程:

    没有 confrim 那怎么实现这个效果呢

    可以使用小程序里的模态框

    代码:

    wxml:

    删除

    js:

    del:function(e){

    varthat=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){},

    })

    }elseif(sm.cancel){

    }

    }

    })

    }

    效果:

    这样就实现js的confirm效果了。

    相关文章

      网友评论

        本文标题:微信小程序删除处理

        本文链接:https://www.haomeiwen.com/subject/wviskxtx.html