zoukankan      html  css  js  c++  java
  • 微信小程序:删除时提示是否删除

    代码如下:

    wx.showModal({
          title: '提示',
          content: '确定要删除吗?',
          success: function (sm) {
            if (sm.confirm) {
                // 用户点击了确定 可以调用删除方法了
              } else if (sm.cancel) {
                console.log('用户点击取消')
              }
            }
    })

    项目中使用:

    deleteById(e) {
          console.log(e);
          this.QueryParam.baseId = e.currentTarget.dataset.id
          var that = this;
          wx.showModal({
            title: '提示',
            content: '确定要删除吗?',
            success: function (sm) {
              if (sm.confirm) {
                  // 用户点击了确定 可以调用删除方法了
                  request.postParam("/api/baseInfo/deleteBaseInfo",that.QueryParam,function(res){
                      console.log(res)
                      if(res.data.success){
                        wx.showToast({
                          title: "删除成功",
                          icon: 'none',
                          duration: 2000
                        })
                        that.getList(true);
                      }else{
                        wx.showToast({
                          title: "删除失败",
                          icon: 'none',
                          duration: 2000
                        })
                      }
                  });
                } else if (sm.cancel) {
                  console.log('用户点击取消')
                }
              }
            }) 
    },

    注意:var that = this;放在外面

  • 相关阅读:
    网页抓取
    基本数据结构
    小节
    顺序统计量
    线性时间排序
    快速排序
    堆排序 Heapsort
    大数运算
    趣味题,文本中洞的数量
    nginx config配置
  • 原文地址:https://www.cnblogs.com/zwh0910/p/14244830.html
Copyright © 2011-2022 走看看