zoukankan      html  css  js  c++  java
  • 【微信小程序】:confirm(删除提示)

    微信小程序删除处理

    没有 confrim 那怎么实现这个效果呢 
    可以使用小程序里的模态框 
    代码:

    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) {
              }
            }
          })
        }

    效果:

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

  • 相关阅读:
    Django-haystack对接elasticsearch
    Django http 和 https 官网解答
    -bash: nohup: command not found
    Mysql 10060登录异常解决方法
    ssh
    sed grep awk用法
    grep用法
    shell 随笔
    列表生成式
    css
  • 原文地址:https://www.cnblogs.com/xuzhengzong/p/7192866.html
Copyright © 2011-2022 走看看