在app的哪些生命周期时,可以确保page已经生成?

发布于 7 年前作者 leitao8890 次浏览最后编辑 7 年前来自 issues

在app的哪些生命周期时,可以确保page已经生成?可以调用getCurrentPage?

1 回复
xyu
xyu1 楼4 年前

https://developers.weixin.qq.com/miniprogram/dev/reference/api/getCurrentPages.html

不要在 App.onLaunch 的时候调用 getCurrentPages(),此时 page 还没有生成。