首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >小程序云开发,读数据表where语句参数为变量无效,常量测试时有效,如何解决?

小程序云开发,读数据表where语句参数为变量无效,常量测试时有效,如何解决?

提问于 2020-06-07 22:09:18
回答 1关注 0查看 409

从一个页面A传递参数id到另一个页面B,以下是页面B的代码,where语句的参数为常量比如 id:1时能返回数据,如果是变量options.id返回不了数据,请帮忙指教,多谢

onLoad: function (options) {

if (options.id) {

const db = wx.cloud.database({

env: 'yunlv'

});

db.collection('poetry')

.where({

id: options.id

})

.orderBy("id", "desc")

.get()

.then(res=>{

console.log("poetry item : ",res.data)

})

}

},

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档