ant-design / pro-components

🏆 Use Ant Design like a Pro!
https://pro-components.antdigital.dev
MIT License
4.3k stars 1.36k forks source link

🐛[BUG] pro-layout 的 logo 在 mobile 模式下会多渲染一层 a 标签,导致在自定义 logo 跳转的时候会有warning #8495

Closed Mankvis closed 4 months ago

Mankvis commented 4 months ago

提问前先看看:

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

🐛 bug 描述

在使用 umi 和 pro-components 布局的时候,在设置 menuHeaderRender 出现问题,如果返回 a 标签则会出现警告 validateDOMNesting(...): cannot appear as a descendant of . 如果不加 a 标签样式又出问题

image image image image

📷 复现步骤

menuHeaderRender={(logo, title) => ( <> <a> {logo} {title} </a> </> )}

🏞 期望结果

💻 复现代码

© 版本信息

  • ProComponents 版本: "@ant-design/pro-components": "^2.7.10",
  • umi 版本 "^4.2.10"
  • 浏览器环境 chrome
  • 开发环境 mac OS

🚑 其他信息

Mankvis commented 4 months ago

{ "private": true, "author": "", "scripts": { "dev": "umi dev", "build": "umi build", "postinstall": "umi setup", "setup": "umi setup", "start": "npm run dev" }, "dependencies": { "@ant-design/pro-components": "^2.7.10", "@emotion/css": "^11.11.2", "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", "antd": "^5.18.1", "umi": "^4.2.10" }, "devDependencies": { "@types/react": "^18.0.33", "@types/react-dom": "^18.0.11", "@umijs/plugins": "^4.2.11", "typescript": "^5.0.3" } }

Mankvis commented 4 months ago

@chenshuai2144