• vue3动态组件组件shallowRef包裹问题


    vue3做tabs切换功能的时候,如果导入的组件不适用shallowRef包裹会显示下面的警告:

    1. Home.vue?t=1708401434509:43 [Vue warn]: Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.
    2. Component that was made reactive: {__hmrId: '2afd162d', __file: 'D:/v3code/my-big-charts/src/components/Comp7.vue', render: ƒ}
    3. at <Home onVnodeUnmounted=fn ref=Ref< Proxy(Object) {__v_skip: true} > >
    4. at <RouterView>
    5. at <App>

    根据提示代码修改如下:

    1. <template>
    2. <ul>
    3. <li v-for="(item,index) in tab" :key="item.name" @click="change(index)">{{ item.name }}li>
    4. ul>
    5. <div>
    6. <component :is="activeComp">component>
    7. div>
    8. template>

    就能解决上面的问题。

  • 相关阅读:
    mybatis
    为什么越来越多的开发者放弃使用Postman,而选择Eolink?
    Linux 查看文件
    基于SSM的运动会管理系统
    Nginx:反向代理(示意图+配置)
    JVM 输出 GC 日志导致 JVM 卡住,我 TM 人傻了
    【JSON2WEB】07 Amis可视化设计器CRUD增删改查
    f12工具
    阿里云服务器企业级和入门级实例规格有何区别?如何选择?
    .NET开源的简单、快速、强大的前后端分离后台权限管理系统
  • 原文地址:https://blog.csdn.net/m0_45925246/article/details/136187151