文档中写的menuData 数据格式如下:
[
{
"path": "/dashboard",
"name": "dashboard",
"icon": "dashboard",
"routes": [
{
"path": "/dashboard/analysis",
"name": "analysis",
"exact": true
},
{
"path": "/dashboard/monitor",
"name": "monitor",
"exact": true
},
{
"path": "/dashboard/workplace",
"name": "workplace",
"exact": true
}
]
}
// ....
]
但实际上数据结构必须为:
[
{
"path": "/dashboard",
"name": "dashboard",
"icon": "dashboard",
"children": [
{
"path": "/dashboard/analysis",
"name": "analysis",
"exact": true
},
{
"path": "/dashboard/monitor",
"name": "monitor",
"exact": true
},
{
"path": "/dashboard/workplace",
"name": "workplace",
"exact": true
}
]
}
// ....
]
才能正确渲染,需要把routes 替换成 children。
有人提过了,但是开发者很傲慢的说他的项目从来不用动态路由,所以就那么放着了
@rhtjUed 来个 pr
https://github.com/ant-design/ant-design-pro-site
我不知道哪一步出错了,侧边栏不出现动态路由,可以看一下您动态路由实现的代码吗?
这个我不是提交过pr了吗?很久了都
https://github.com/ant-design/ant-design-pro-site/pull/325
但是大佬好像根本没处理
@leshalv 非常感谢