求大佬帮忙解答下
给this.goods赋了个空值undefined,在undefined上调用属性自然报错了呗。应该先判断this.goods是否为空,再调用this.goods.details
onLoad加个判断类似于这个。至于数据没请求到,先看看接口参数是否传对了,然后看看接口http码比如200,之类的,network里,有没有返回什么东西
if(!this.good.detail&&this.good.detail.length!=0){
this.detail=this.good.detail[0];
}else{
this.detail={};
}