小程序云开发无法手机预览
发布于 4 年前 作者 xiechao 13665 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)
  1. 开发使用了 云开发功能,并在上面储存了数据

  2. 在开发者工具中可以正常读取数据

  3. 开发者工具点击预览 手机微信扫描后 无法读取数据

  4. 我没有配置微信小程序的  服务器域名  难道是只有购买了服务器并配置好服务器域名才可以使用吗?

代码如下

searchDataByInputValue:function(){
  console.log("用户输入  " + this.data.inputVal)
  var tmp = [];
 
  const db = wx.cloud.database()
  const testDB = wx.cloud.database({
    env: 'lajifenlei'
  })
 
  const _ = db.command
  const test = db.collection('lajiData')
  var that = this;
  test.where({
    name: db.RegExp({
      regexp: that.data.inputVal,
      options: 'i',
    })
  }).get({
    success: function (res) {
      console.log(" 读取数据库 结果  " + res.data)
      that.setData({
        tmpData: res.data
      });
      console.log(that.data.tmpData.length)
    }
     
  })
 
 
}
  • 预期表现

手机预览可以正常读取数据库中的数据

  • 复现路径
  • 提供一个最简复现 Demo

谢谢

1 回复

测试未复现

回到顶部