鍍金池/ 問答/HTML/ 微信小程序通過setData填充數(shù)據(jù)的數(shù)組為何length為0

微信小程序通過setData填充數(shù)據(jù)的數(shù)組為何length為0

在data中設(shè)置的數(shù)組,setData填充入list但是該數(shù)組的length還是0是一個空數(shù)組,這是什么原理

圖片描述圖片描述

回答
編輯回答
墨沫

onLoad 是生命周期的第一個函數(shù)
你setData還沒有執(zhí)行到
所以 length 等于 0 了

2017年7月13日 14:51
編輯回答
病癮

不能在onLoad里面console啊老兄

2017年6月11日 02:29