data: {
goods_detail:{},
cart:[],
collect:{},
isCollect:false,
},
onLoad: function (options) {
const phoneCheck = wx.getStorageSync('phone')
if(!phoneCheck){
wx.switchTab({
url: '../index/index',
})
}
wx.showLoading();
var that = this;
let app = getApp();
let setUrl = app.globalData.ip+"/goods/detail?gid="+options["gid"];
async function getDetail(){
try{
const res = await request({url:setUrl});
await wx.hideLoading();
that.setData({
goods_detail:res.data,
})
}catch(err){
console.log(err);
}
};
getDetail()
},
别的都可以setData,只有这个goods_detail不可以,在真机调试里面只有这个是empty的,偶尔可以加载出来。安卓是可以的,换成ios就不行了,有大哥知道是为啥吗。
你得先说说请求回来有没有数据