在开发时经常遇到 使用到的obj的key值是通过参数等动态设置的。

 

that.setData({

[clock]: dateformat(total_micro_second)

});

 

使用[]将需要传入的参数扩起来,clock将会取参数的实际值。

TAG标签: 微信小程序newset

http://www.xiaochengxub.com/read-104830.html