# 小程序生命周期
以下方法按照执行开始顺序排列,但是方法是并列执行的,并不保证方法结束时间的先后顺序。主要是自定义组件这里生命周期加入会使得整个小程序生命周期变多了,重新梳理一下
# APP
- onLaunch
- onShow
# Page (opens new window)
- onLoad
- onShow
# Component (opens new window)
# 自定义组件生命周期
- created(注意这里还不能setData,只能给this添加自定义属性)
- attached
- ready
- moved
- detached
# 自定义组件页面生命周期
- show
- hide
- resize
# behaviors
类似mixin的东西,但是这个也对生命周期会有影响。 后续补充
# 大致整体顺序
- APP onLaunch执行
- APP onShow执行
- Components created
- Components attached
- Page onLoad
- Components show
- Page onShow
- Components hide(可能,如page onLoad调用了wx.previewImage)
- Components ready