Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

menu组件items参数使用computed计算属性且label参数值为VNode时出现很多错误 #6864

Closed
1 task
catpigdog opened this issue Aug 18, 2023 · 13 comments

Comments

@catpigdog
Copy link

catpigdog commented Aug 18, 2023

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

Version

4.0.0-rc.6

Environment

vue3

Reproduction link

https://github.com/catpigdog/bug-antdforvue-menu

Steps to reproduce

使用Menu时 items参数传入一个computed返回值ItemType,且ItemType的label属性值为VNode时
menu会出现样式错乱,openKeys selectedKeys 参数没作用, inline-collapsed 参数改变时报错

What is expected?

正确渲染

What is actually happening?

报错 渲染错乱


ItemType['label'] VueNode 能改为 VueNode | ()=>VueNode 就很棒

@github-actions
Copy link

Hello @catpigdog. We totally like your proposal/feedback, welcome to send us a Pull Request for it. Please send your Pull Request to proper branch, fill the Pull Request Template here, provide changelog/TypeScript/documentation/test cases if needed and make sure CI passed, we will review it soon. We appreciate your effort in advance and looking forward to your contribution!

你好 @catpigdog,我们完全同意你的提议/反馈,欢迎直接在此仓库创建一个 Pull Request 来解决这个问题。请将 Pull Request 发到正确的分支,务必填写 Pull Request 内的预设模板,提供改动所需相应的 changelog、TypeScript 定义、测试用例、文档等,并确保 CI 通过,我们会尽快进行 Review,提前感谢和期待您的贡献。

@kovsu
Copy link
Member

kovsu commented Aug 23, 2023

@catpigdog openKeys selectedKeys 参数没作用,是因为你没有给 key 值吧,看了一眼你仓库。其他地方你要不再仔细描述一下?[😛]

@catpigdog
Copy link
Author

@catpigdogopenKeys selectedKeys 参数没作用,是因为你没有给 key 值吧,赶紧查看一下你的仓库。其他地方你要不再仔细描述一下吗?[😛]
抱歉,key字段写成了name字段,仓库代码已更新。但是这个问题依然是存在的

@kovsu kovsu self-assigned this Aug 25, 2023
@catpigdog
Copy link
Author

catpigdog commented Aug 25, 2023

icon和我这个问题无关,主要是由label传入Vnode后,且由vue computed计算属性返回就会出现布局错乱问题:
以下是传入items内容后,更新inlineCollapsed参数或者点击该菜单 item1时 就会出现布局错乱,在该菜单位置多生成一个menu

const items = computed(() => [
  {
    key: 'sub1',
    icon: () => h(SettingOutlined),
    label: 'Navigation Three - Submenu',
    title: 'Navigation Three - Submenu',
    children: [
      {
        type: 'group',
        label: 'Item 1',
        children: [
          {
            label: h(AppstoreOutlined),
            title: 'setting:1',
            key: 'setting:1',
          },
          {
            label: 'Option 2',
            key: 'setting:2',
          },
        ],
      }
    ],
  }
]);

bug

@kovsu

Copy link

github-actions bot commented Nov 5, 2023

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Stale label Nov 5, 2023
@greenhat616
Copy link

Not stale

@github-actions github-actions bot removed the Stale label Nov 6, 2023
Copy link

github-actions bot commented Jan 5, 2024

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Stale label Jan 5, 2024
@greenhat616
Copy link

not stale

@github-actions github-actions bot removed the Stale label Jan 6, 2024
Copy link

github-actions bot commented Mar 7, 2024

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Stale label Mar 7, 2024
@greenhat616
Copy link

not stale

@github-actions github-actions bot removed the Stale label Mar 8, 2024
Copy link

github-actions bot commented May 7, 2024

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Stale label May 7, 2024
@greenhat616
Copy link

not stale

@github-actions github-actions bot removed the Stale label May 8, 2024
Copy link

github-actions bot commented Jul 7, 2024

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants