Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

购物车页面无法显示并报错 #67

Open
MXHanner opened this issue May 26, 2019 · 1 comment
Open

购物车页面无法显示并报错 #67

MXHanner opened this issue May 26, 2019 · 1 comment

Comments

@MXHanner
Copy link

大佬,微信小程序购物车界面不显示任何内容了为什么呀,Console报错
Uncaught (in promise) TypeError: Cannot read property 'images' of null
at index.js:44
at Array.forEach ()
at index.js:44
at
我点开index.js,Sources标注pages/cart/index.js下面最长的那一句后面括号里错误:
getCarts() {
App.HttpService.getCartByUser()
.then(res => {
const data = res.data
console.log(data)
if (data.meta.code == 0) {
data.data.forEach(n => n.goods.thumb_url = App.renderImage(n.goods.images[0] && n.goods.images[0].path))
this.setData({
'carts.items': data.data,
'prompt.hidden': data.data.length,
})
}
})
},
是因为我把后端的数据都换掉了吗[/害怕]

@MXHanner
Copy link
Author

我把data.data.forEach(n => n.goods.thumb_url = App.renderImage(n.goods.images[0] && n.goods.images[0].path))给注释掉了就可以显示页面了,但是就没有图片了

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant