Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

能在app.js中调用$preload么? #39

Open
myjf007 opened this issue Jan 19, 2019 · 2 comments
Open

能在app.js中调用$preload么? #39

myjf007 opened this issue Jan 19, 2019 · 2 comments

Comments

@myjf007
Copy link

myjf007 commented Jan 19, 2019

No description provided.

@Mister-Hope
Copy link
Contributor

没试过,应该是不行吧。我觉得这个需求是不需要的啊。
我的做法是利用onPageLaunch这个参数,根据小程序打开的界面提前处理当前界面的一些逻辑。
一般不是需要尽快加载小程序的第一个界面么?我的preload是放在所有可以分享或者有二维码或者首屏页面中的onReady中的,当然preload也可以放在你打开第一个见面的onPageLaunch里。
希望能帮到你

@switer
Copy link
Member

switer commented Jan 20, 2019

$preload是实例无关的,如在 onLaunch 生命周期内使用,此时preload的页面已完成注册,理论上可以说能完成preload操作,但app实例并不提供$preload方法。@GODOFHOPE 回答的对,app的生命周期是全局生效的,需要preload最好有页面限制,避免不相干的页面preload影响打开速度

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants