pro-components icon indicating copy to clipboard operation
pro-components copied to clipboard

🐛[BUG] Pro Layout: route 参数正常传递, 但导航列表不渲染, ul 上有 items 属性为 object

Open hylerrix opened this issue 3 years ago • 2 comments
trafficstars

🐛 bug 描述

今天看 Pro Layout 升级为 v7 了,我就在我手里的项目升级了下,遇到了这个 BUG。 回退版本后,发现还是有问题,也就是和版本无关了

什么情况下,routes 传递了,但是渲染不出来呢?

  • pro-layout: 之前是 v6.38.10,现在是 v7.0.5
  • antd: 之前是 4.20.0,现在是 v4.23.1

能看出来导航容器 ul 已经有 items 属性了(最后一张图),但是没有把所有子导航渲染成 li?

📷 复现步骤

🏞 期望结果

期望能正常渲染导航!

💻 复现代码

正常传递一个很普通的 routes 数组都不行?

image

© 版本信息

  • ProComponents 版本: [e.g. 4.0.0]
  • umi 版本
  • 浏览器环境
  • 开发环境 [e.g. mac OS]

🚑 其他信息

image

hylerrix avatar Sep 13 '22 09:09 hylerrix

我可能是不一样的问题, 不过也是导航渲染不出来, 项目中用了老版的 layout https://github.com/ant-design/ant-design-pro-layout/tree/master/example/src/layouts

新版中 没有与之对应的升级, 感觉完全是不一样的东西了,

可不可以搞个例子,能让人一键升级的?  新版的代码太多了, 不像老版的那么简洁, 很难上手。。。

wensheng006 avatar Sep 14 '22 12:09 wensheng006

https://github.com/ant-design/ant-design-pro-layout/blob/master/example/config/config.ts


 path: '/',
      component: '../layouts/BasicLayout',
      routes: [
        {
          path: '/welcome',
          name: 'welcome',
          icon: 'smile',
          component: './Welcome',
        },

以前的是 component: '../layouts/BasicLayout', 新版本就没了, 我接收的是老项目, 希望能还能支持原来的用法, 或者有个升级文档什么的, 谢谢了

wensheng006 avatar Sep 14 '22 12:09 wensheng006

routes 和 children 的变化。注意看下控制台有提示

chenshuai2144 avatar Dec 27 '22 14:12 chenshuai2144