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

data数据:

data: {
    assets: null
}

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

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

猜你喜欢

转载自www.cnblogs.com/zinan/p/12205041.html