小程序setData只修改对象中的某个属性的方法

时间:2020-01-17 13:43:23   收藏:0   阅读:150

data数据:

data: {
    assets: null
}

setData方法,使用["对象.属性"]的方式来更新某个属性的值。

this.setData({ ["assets.diamonds"]: diamonds });

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!