小程序
小游戏
企业微信
微信支付
扫描小程序码分享
两个都是undefined
4 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
你还没赋值就去取值了吧?
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
onShow: async function(){
if(!this.data.bookInfo || !this.data.bookInfo.fileID){
var res = await db.collection('file').where({
book: '书名'
}).get()
this.setData({
bookInfo: res.data[0]
})
}
你是异步赋值 同步取吧 这能取得到么
看一下控制台AppData有没有值,没有值,当然就取不出来了。注意一下this
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
你还没赋值就去取值了吧?
onShow: async function(){
if(!this.data.bookInfo || !this.data.bookInfo.fileID){
var res = await db.collection('file').where({
book: '书名'
}).get()
this.setData({
bookInfo: res.data[0]
})
}
}
你是异步赋值 同步取吧 这能取得到么![](http://mmbiz.qpic.cn/mmbiz_png/1q9b8kff6mpqac4MXNAm86S7xgudnlYTwQbAXfLw6qznJNxSEmGgrG13M5olD6PswUlwU3uweY5LYr4u2x9Umg/0?wx_fmt=png)
看一下控制台AppData有没有值,没有值,当然就取不出来了。注意一下this