Skip to content

antDesignVue的Menu组件当传错Icon值类型渲染时正常且不告警,但跳转时引发__asyncLoader报错导致跳转失败,且影响主程序正常跳转 #8026

@liu770848166

Description

@liu770848166
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

4.2.6

Environment

prod

Reproduction link

https://github.com/vueComponent/ant-design-vue/blob/main/components/menu/src/MenuItem.tsx

案例地址

https://stackblitz.com/edit/vitejs-vite-k6pz5xtj

Steps to reproduce

当使用menu组件时,配置了items为一下配置(举例类似):

items = [
  {
    key: '1',
    icon: '12312',
    label: 'Navigation One',
    title: 'Navigation One'
  },
  {
    key: '2',
    label: 'Navigation Two',
    title: 'Navigation Two'
  }
]

当使用时界面展示并无异常和告警,但是当页面路由跳转时,页面路由正常变化,但是无法重新渲染,且直接报错,阻塞程序正常运行。
经排查发现当页面跳转前卸载icon Vnode节点是类型错误,无法正常卸载。

What is expected?

使用传值时增加检验传值类型,并增加报错或异常提醒

What is actually happening?

页面卸载时导致报错无法卸载,并阻塞页面无法正常跳转


以下内容作为某个页面时即可触发报错,并导致跳转异常 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '__asyncLoader')

<template>
  <div>
    <button @click="$router.push('/cart')">{{ tt }}</button>
    <Menu :items="items"></Menu>
  </div>
</template>

<script setup>
  import { ref, h } from 'vue'
  import { Menu } from 'ant-design-vue'
  
  const tt = 123
  
  const items = ref([
  {
  key: '1',
  icon: '12312',
  label: 'Navigation One',
  title: 'Navigation One'
  },
  {
  key: '2',
  label: 'Navigation Two',
  title: 'Navigation Two'
  }
  ])
</script>

<style scoped>
  .box {
  font-size: 100px;
  }
</style>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions