Global defaults for defineAsyncComponent #564
brendomaciel
started this conversation in
General
Replies: 1 comment 1 reply
-
the proposed solution doesn’t seem to bring much. Note you could also create your own defineAsyncComponent that adds the defaults. In other words: this could be 100% userland |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What problem does this feature solve?
In medium/large applications, where we can have lots of routes (therefore lots of async page components), we have to define the options of
defineAsyncComponent
for every of these components.Let's say we need to define a different default
delay
or genericloadingComponent
/errorComponent
. We need to create an object, import it and merge it. Something like that:When doing that for a bunch of routes the file ends up having a lot of repetition, which is not the ideal.
What does the proposed API look like?
Since Vue offers an API for global app configuration, it would be much more convenient to define default options for
defineAsyncComponent
using it, this way we can keep using the function's simpler syntax for those components that doesn't need to override the app defaults.Beta Was this translation helpful? Give feedback.
All reactions