Can we add components or plugins after app is mounted? #12270
-
Hello all,
I understand that Comp2 and MyPlugin should not be used until the async operation is finished, because vue doesn't recognize them. However that can be solved by numerous ways (such as a flag). The question is if Vue does something interally that will result in issues with this setup. PS: If this has been answered somewhere please point it out, because I couldn't find anything related |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Why don’t you use |
Beta Was this translation helpful? Give feedback.
-
You shouldn’t do this! Registering components or plugins after Instead, use Hope that helps! |
Beta Was this translation helpful? Give feedback.
You shouldn’t do this! Registering components or plugins after
app.mount
can lead to hidden dependencies and subtle reactivity issues, plus other complexities within Vue’s ecosystem.Instead, use
v-if
for conditional rendering or lazy-load components (defineAsyncComponent
) as needed. These approaches avoid the pitfalls of async registration.Hope that helps!