在微信小程序开发过程中往往会遇到需要更改数组中某一项的某个对象的值,这个时候我们使用this.setdata赋值可能就不知道应该怎么写了,我整理了一下,相关的语法,欢迎交流。
一、this.setdatad的复杂赋值
1.
this.setData({
['current.fieldValueMap['+index+'].fieldValue']:''
})
2.
var str = 'current.fieldValueMap['+index+'].fieldValue'
this.setData({
[str]:''
})
3.如果不需要有变量的话仅需要
this.setData({
'current.fieldValueMap.fieldValue':''
})