|
作者:李留白,來(lái)自原文地址 官網(wǎng)文檔在使用setData()設(shè)置數(shù)組對(duì)象的某個(gè)元素的屬性時(shí),是這么使用的:
使用了 ‘array[0].text’ : ‘changed data’ 這樣的值。但在實(shí)際使用中,我們對(duì)數(shù)組的中的某個(gè)元素的設(shè)置是動(dòng)態(tài)的。即 我們通常應(yīng)該是 ‘array[‘+index+’].text’ : ‘changed data’ ,其中index應(yīng)該是一個(gè)動(dòng)態(tài)的數(shù)字。但顯然,這樣是無(wú)法使用在對(duì)象的key中的。 所以,我只能使用了一個(gè)變通的方法。如下:
即提前把對(duì)象準(zhǔn)備好。 希望以后可以有更好的方法。 二:Error之util.randomString is not a function作者:古加文,來(lái)自原文地址 WAService.js:3 thirdScriptError util.randomString is not a function;at “pages/index/index” page lifeCycleMethod onLoad function TypeError: util.randomString is not a function |