onPullDownRefresh //頁面相關事件處理函數–-監聽用戶下拉動作,從而刷新頁面
onReachBottom //頁面上拉觸底事件的處理函數--用於分頁處理刷新頁面
onShareAppMessage //用戶點擊右上角轉發
onPageScroll //頁面滾動觸發事件的處理函數
onTabItemTap // 當前是 tab 頁時,點擊 tab 時觸發。這個事件本身還有缺陷待修復。
componentWillPreload //預加載,只在微信小程序中可用
componentWillMount //在微信小程序中這一生命周期方法對應頁面的onLoad或入口文件app.js中的onLaunch
componentDidMount //在微信小程序中這一生命周期方法對應頁面的onReady或入口文件app.js中的onLaunch,在 componentWillMount后執行
componentDidShow //在微信小程序中這一生命周期方法對應 onShow
componentDidHide //在微信小程序中這一生命周期方法對應 onHide
componentDidCatchError //錯誤監聽函數,在微信小程序中這一生命周期方法對應 onError
componentDidNotFound //頁面不存在監聽函數,在微信小程序中這一生命周期方法對應 onPageNotFound
shouldComponentUpdate //頁面是否需要更新
componentWillUpdate //頁面即將更新
componentDidUpdate //頁面更新完畢
componentWillUnmount //頁面退出,在微信小程序中這一生命周期方法對應 onUnload
1、入口文件繼承自 Component 組件基類,它的生命周期不如組件完整,包含如下:
componentWillMount、componentDidMount、componentDidShow、componentDidHide、componentDidCatchError、componentDidNotFound
2、不要在入口文件中的 render 方法里寫邏輯及引用其他頁面、組件,因為編譯時 render 方法的內容會被直接替換掉,你的邏輯代碼不會起作用。