Skip to content
Advertisement

How to dynamically import Vue 3 component?

According this article I would like to import component to view dynamically to my Vue 3 app. The code of the view looks like:

JavaScript

Code does not throw any errors but I dont see the component on the page. If I use first import style it works. Am I missing somethig?

Advertisement

Answer

You need to use defineAsyncComponent in Vue 3 to lazy load components

JavaScript

https://v3-migration.vuejs.org/breaking-changes/async-components.html#overview

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement