在app的哪些生命周期时,可以确保page已经生成?
发布于 6 年前 作者 leitao 8730 次浏览 来自 官方Issues

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

1 回复

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

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

回到顶部