3***@qq.com
3***@qq.com
  • 发布:2025-04-10 16:20
  • 更新:2025-04-10 16:28
  • 阅读:173

uniapp的component标签在小程序不支持,不通过v-if如何实现动态加载组件

分类:uni-app
<template>  

    <component :is="bannerCarouselVue"></component>  

    <custom-tabbar></custom-tabbar>  

</template>  

<script setup>  
    import {  
        onLoad  
    } from '@dcloudio/uni-app';  
    import {  
        ref  
    } from 'vue'  
    import bannerCarouselVue from '../../components/carousel/banner-carousel.vue';  

    const data = [{  
        name: '首页轮播图',  
        componentPath: '/components/carousel/banner-carousel',  
        props: {},  
    },{  
        name: '卡片列表',  
        componentPath: '/components/carousel/card-list',  
        props: {},  
    }]  
</script>  

<style>  

</style>
2025-04-10 16:20 负责人:无 分享
已邀请:
DCloud_UNI_JBB

DCloud_UNI_JBB

动态组件不支持 小程序平台

  • 3***@qq.com (作者)

    大哥,我知道不支持,有没有什么办法可以达到一样的效果呢

    2025-04-10 17:09

  • DCloud_uniCloud_JSON

    回复 3***@qq.com: 可以参考 uni-im 用 vite 实现

    2025-04-21 20:00

要回复问题请先登录注册