简单变量直接可用引号 ‘a.b.c’ 。
访问数组下标使用[ ]时用到变量,可使用es6新特性
示例:
let index = this.data.messageList.findIndex(item => this.data.dialog.code === item.code);
this.setData({
'dialog.show': false,
['messageList['+index+'].isread']: true
});
this.setData({
['messageList['+e.currentTarget.dataset.index+'].isread']: true