小程序单独设置数组对象中某一个属性值
如题,js代码如下
page({
data:{
list:[{a:1,b:2,c:3},{a:12,b:22,c:32},{a:13,b:23,c:33}],
test:{aa:1,bb:2,cc:3}
},
jian(e){
let i = e.currentTarget.dataset.index
let that = this
let currentDysl = `list[${i}].a`
this.setData({
[currentDysl]:parseInt(that.data.list[i].a) - 1
})
},
jia(e){
this.setData({
['test.aa']:22
})
}
})