1、更改数组中的值
list: [
{txt:'txt1',flag:true},
{txt:'txt2',flag:true}
]
chooseSHK:function(e){
let choseChange = "list[" + e.currentTarget.id + "].flag";
this.setData({
[choseChange]: false
})
}
2、更改对象中的值
userInfo: {
sex: '',
name: '',
},
let userSex = "userInfo.sex"
this.setData({
[userSex]: '1'
})
网友评论