onLoad: function (options) {
var that = this;
wx.request({
url: app.d.ceshiUrl + '/Api/Index/index',
//url: 'https://62222.qicp.vip/index.php/Api/Index/index',
method:'post',
data: {},
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
//success: function (res) {
success: res => {
var ggtop = res.data.ggtop;
//var ggtop = app.d.ceshiUrl + '/Api/Index/index';
var procat = res.data.procat;
//var procat = app.d.ceshiUrl + '/Api/Index/index';
var prolist = res.data.prolist;
var brand = res.data.brand;
var course = res.data.course;
//that.initProductData(data);
that.setData({
imgUrls:ggtop,
proCat:procat,
productData:prolist,
brand: brand,
course: course
});
//endInitData
},
fail:function(e){
wx.showToast({
title: '网络异常!',
duration: 2000
});
},
})
},
执行后出现
setting data fiel "imgurls" to undefined is invalid
无法获取到值,请问是什么原因,代码需要怎么修改?
你这可以。
你检查下后端接口返回的数据吧,ggtop为空了。