源码:
bindMultiPickerColumnChange: function (e) {
var jectMul = new Array;
var data = {
objectMultiArray: this.data.objectMultiArray,
multiIndex: this.data.multiIndex
};
data.multiIndex[e.detail.column] = e.detail.value;
var that = this;
wx.request({
url: AppData.AppConfigData.weburl + ‘/WxForm/WebClass2.html’,
data: { cid: data.objectMultiArray[0][e.detail.value].id },
method: ‘GET’,
header: { ‘content-type’: ‘application/json’ },
success: function (res) {
that.setData({
jectMul: res.data
})
}
});
this.data.objectMultiArray[1] = this.data.jectMul;
console.log(‘asdasd值22为’, this.data);
console.log(‘asdasd值23332为’, jectMul);
data.multiIndex[1] = 0;
this.setData(this.data);
},
这个是一个二级联动分类选择器。选择一级后,根据ID读数据库显示二级。
this.data 显示 jectMul 是实时数据
但 this.data.jectMul 是不确定数据!!
怎么才能使 this.data.objectMultiArray[1] = this.data.jectMul; 这个等式成立。每次调用都准确替换objectMultiArray的值