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

生命周期函数不支持 async 吗? #7333

Closed
pengzhen-developer opened this issue Dec 28, 2017 · 2 comments
Closed

生命周期函数不支持 async 吗? #7333

pengzhen-developer opened this issue Dec 28, 2017 · 2 comments

Comments

@pengzhen-developer
Copy link

What problem does this feature solve?

希望生命周期函数能够提供 async 的支持

What does the proposed API look like?

async create(){
await something()
}

mounted() {
// wait something done
}

@yyx990803
Copy link
Member

不支持,因为整个 diff 和 render 的算法都是基于组件生命周期同步执行的前提下的。而且任意一个组件的生命周期可能异步推迟最后的渲染完成是绝对不应该出现的设计。

@lyh2668
Copy link

lyh2668 commented Dec 28, 2017

@pz25925 只需要把async的方法都放在methods里面然后再在生命周期函数调用就可以了,这样也不会影响生命周期函数本身的正常执行。

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