-
Notifications
You must be signed in to change notification settings - Fork 344
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
feat: add defineAsyncComponent API #644
Conversation
const component = load() | ||
|
||
return { | ||
component: component as any, // there is a type missmatch between vue2 type and the docs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Types of Vue2 are not correct in that place I created a PR for that vuejs/vue#11906
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some runtime tests as well? Thanks.
Will work in it. Should be easy with the test from vue3 https://github.com/vuejs/vue-next/blob/master/packages/runtime-core/__tests__/apiAsyncComponent.spec.ts ... |
Added tests. Following things are not like vue3:
|
Thanks👍 |
This PR adds a implementation for defineAsyncComponent (I used code from the vue3 implementation) and returns a function async component as used in vue2 (see docs link). This should be a quite similar implementation as vue3 uses and should be compatible in most cases.
Some notes:
Not shure of the typing ofComponent
usedVueProxy<any,any>
but maybe there are better options