data{
person:
[
{age:18,name:'xiaoming'},
{age:22,name:'xiaohua'}
]
}
function(){
let per = this.data.person[0]
this.setData({
['per.age']: 15,
['per.value']: 'lantian',
})
}
请问一下,我的这样写法有什么问题嘛,没有任何的效果,我尝试也用下面的写法也是没有效果
另外写法1:
function(){
let per = this.data.person[0]
this.setData({
[per.age]: 15,
[per.value]: 'lantian',
})
}
另外写法2:
function(){
let per = this.data.person[0]
this.setData({
per.age: 15,
per.value: 'lantian',
})
}
另外写法3:
function(){
let per = this.data.person[0]
this.setData({
‘per.age’: 15,
‘per.value’: 'lantian',
})
}
明白了 ,谢谢
https://developers.weixin.qq.com/community/develop/doc/000cac658c4ec894a1476ded751004?highLine=%25E4%25BF%25AE%25E6%2594%25B9%25E6%2595%25B0%25E7%25BB%2584%25E6%259F%2590%25E4%25B8%2580%25E9%25A1%25B9
。。。。this.data.person[0].age=15
this.setData({
person: this.data.person
})