Ant-design-pro: 🐛[BUG]移动端访问报错:<a> cannot appear as a descendant of <a>.

Created on 25 Nov 2019  ·  7Comments  ·  Source: ant-design/ant-design-pro

🐛 bug 描述

将开发者工具调成移动设备后,会出现<a> cannot appear as a descendant of <a>.的警告

📷 复现步骤

移动设备访问

💻 复现代码

logo包了一层a标签

image

© 版本信息

  • Ant Design Pro 版本: 4.5.16
🛑 bug

All 7 comments

a 不能嵌套 a,看来是dom 导致的,我换个标签

@chenshuai2144 PC端缩放的时候也会出现这个Warning,导致的该原因出现的位置:BasicLayout.jsx/menuHeaderRender方法内部,

<Link to="/">
      {logoDom}
      {titleDom}
 </Link>

// 替换为
<>
     {logoDom}
      {titleDom}
</>

image

image

@twtyjvkg

但是这样就没有点击跳转功能了呀

自定义不就有了? 报错问题有解决么?

自定义不就有了? 报错问题有解决么?

解决了,谢谢

在新版本中使用了div,不会出现 a 嵌套 div 的情况了

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yjz1004 picture yjz1004  ·  3Comments

Jerry-goodboy picture Jerry-goodboy  ·  3Comments

Yoping picture Yoping  ·  3Comments

skyFi picture skyFi  ·  3Comments

yadongxie150 picture yadongxie150  ·  3Comments