this.data.rwx=[]
this.data.rwx[0]['rw'] = this.data._id//报错
或者
this.data.rwx=[]
this.data.rwx[0].rw= this.data._id//也报错
这里必须要加索引[0],因为要for循环赋值
this.data.rwx=[]
this.data.rwx[0]['rw'] = this.data._id//报错
或者
this.data.rwx=[]
this.data.rwx[0].rw= this.data._id//也报错
这里必须要加索引[0],因为要for循环赋值
let rwx = [];
rwx[0] = {
rw:
this
.data.id
};this.setData({
rwx: rwx
})
如果需要更新视图要用setData,不能直接使用等号赋值
谢邀
this.data.rwx = []
this.data.rwx.push({rw: this.data._id})