在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答/網(wǎng)絡(luò)安全  HTML/ 小程序數(shù)據(jù)傳遞問(wèn)題

小程序數(shù)據(jù)傳遞問(wèn)題

var postsData = require("../../data/posts-data.js");

Page({
data: {

autoplay: true,
circular: true

},
onLoad: function (options) {

this.data.post_key = postsData.postList //通過(guò)這種方式為什么傳遞不了數(shù)據(jù),但是換成
//this.setData({post_key: postsData.postList})就沒問(wèn)題,我數(shù)據(jù)沒問(wèn)題的
}

})

<block wx:for="{{post_key}}">
回答
編輯回答
陌南塵

文檔里加粗寫著

直接修改 this.data 而不調(diào)用 this.setData 是無(wú)法改變頁(yè)面的狀態(tài)的,還會(huì)造成數(shù)據(jù)不一致。
2018年5月15日 15:15