使用defineAsyncComponent解决Vue3中的动态组件不显示问题

参考: https://www.php.cn/faq/562208.html

之前的写法

<component :is='xxx'></component>

异步加载组件

<template>
   <AsyncComponent v-if="item.data" :key="item.data.comId"></AsyncComponent>
</template>

<script setup>
  const AsyncComponent = defineAsyncComponent(() => {
    return import ('@/components/DynamicComponents/DynamicCom01.vue')
  })
</script>
posted @ 2024-02-25 22:30  Felix_Openmind  阅读(913)  评论(0)    收藏  举报
*{cursor: url(https://files-cdn.cnblogs.com/files/morango/fish-cursor.ico),auto;}