fail查询失败,但是失败效果不现实
发布于 4 年前 作者 guming 5144 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)
  • 预期表现
  • 复现路径
  • 提供一个最简复现 Demo

未查到数据时调用的fail函数不显示 代码如下 //单击“查询数据”按钮执行该函数

  queryData: function () {

    var that = this

    //  根据记录ID搜索数据集 

 

    this.db.collection(‘test’).where({ name: this.data.recordId }).get({

      // 找到记录集调用

      success: function (res) {

        //  将查询结果显示在页面上

         if(name=null){

           wx.showModal({

             title: ‘错误’,

             content: ‘请输入正确的数值’,

             showCancel: false

           })

         }

          that.setData({

            kindResult: res.data[0].kind

          })

 

      },

      //  未查到数据时调用

      fail: function (res) {

        wx.showModal({

          title: ‘错误’,

          content: ‘没有找到记录’,

          showCancel: false

        })

      }

    })

  },

1 回复

没有明白需要反馈的问题,麻烦具体描述

回到顶部