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

onAwake 函数内部 this 为null #20

Open
GoToBoy opened this issue Jul 4, 2018 · 4 comments
Open

onAwake 函数内部 this 为null #20

GoToBoy opened this issue Jul 4, 2018 · 4 comments

Comments

@GoToBoy
Copy link

GoToBoy commented Jul 4, 2018

如题 ,page页面内部 onAwake this 显示null;

另外page里面有个onAppShow, 这个函数只有当前页面从后台切换前台才会执行,和onAwake功能重叠了?

@switer
Copy link
Member

switer commented Jul 10, 2018

onAppShow只是一个原子方法,直接挂在App.onShow上。onAwake是一个从App.onHide => App.onShow的封装概念,有点类似onShow,但实际会多一些状态值,例如后台时间,这些状态了直接放在 App.onShow 上是不适合的。

@GoToBoy
Copy link
Author

GoToBoy commented Jul 17, 2018

如果绑定当前页面的page对象,需要
P({ onAwake.call(this)(){ //这样子么? } })

@GoToBoy
Copy link
Author

GoToBoy commented Jul 17, 2018

tvfe的小程序数据是怎么管理的?有没有用到mobx这样子的状态机?

@switer
Copy link
Member

switer commented Jul 17, 2018

wxpage没有涉及数据管理部分,你可以引入mobx

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

2 participants