Skip to content

动态更改a-menu的theme属性是会报错 #7964

@grover142224

Description

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

Version

4.2.6

Environment

"vue": "^3.5.12",

Reproduction link

https://www.antdv.com/components/menu-cn

Steps to reproduce

新建一个简单页面,代码如下


<a-button @click="toggle">点我

<script lang="ts" setup> import type { ItemType, MenuTheme } from "ant-design-vue"; import { AppleFilled } from "@ant-design/icons-vue"; const theme = ref("light" as MenuTheme); const toggle = () => { theme.value = theme.value === "light" ? "dark" : "light"; }; const items: ComputedRef = computed(() => [ { icon: h(AppleFilled), title: "修改米啊", label: "修改米啊", key: "0" }, ]); </script>

点击按钮切换主题,会报错

What is expected?

动态更改menu组件的theme不报错

What is actually happening?

上面的代码在浏览器运行时会报错
runtime-core.esm-bundler.js:5926 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'subTree')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions