ant-design / ant-design/pro-components

🧐[问题]ProLayout组件,不使用UMI,使用ReactRouter,配置路由、导航菜单和面包屑的最佳方案是?

Open
#7,493 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.8k
Forks
1.4k
Avg merge
10h 44m
Merged PRs (30d)
3

Description

### 🧐 问题描述

ProLayout组件,不使用UMI,使用ReactRouter,配置路由、导航菜单和面包屑的最佳方案是什么?

测试了配置route属性,可以生成菜单,但是没有生成连接

image

```
import { ProLayoutProps } from '@ant-design/pro-layout';
import { ChromeFilled, CrownFilled, SmileFilled, TabletFilled } from '@ant-design/icons';
import React from 'react';

const Home = React.lazy(() => import('pages/Home'));
const Sample = React.lazy(() => import('pages/Sample'));

const props: ProLayoutProps = {
fixSiderbar: true,
layout: "side",
splitMenus: false,
contentWidth: 'Fluid',
siderMenuType: 'group',
fixedHeader: true,
route: {
path: '/',
routes: [
{
path: '/welcome',
name: '欢迎',
icon: ,

},
{
path: '/admin',
name: '管理页',
icon: ,
access: 'canAdmin',
routes: [
{
path: '/admin/sub-page1',
name: '一级页面',
icon: 'https://gw.alipayobjects.com/zos/antfincdn/upvrAjAPQX/Logo_Tech%252520UI.svg',
},
{
path: '/admin/sub-page2',
name: '二级页面',
icon: ,
},
{
path: '/admin/sub-page3',
name: '三级页面',
icon: ,
},
],
},
{
name: '列表页',
icon: ,
path: '/list',
routes: [
{
path: '/list/sub-page',
name: '列表页面',
icon: ,
routes: [
{
path: 'sub-sub-page1',
name: '一一级列表页面',
icon: ,
component:
},
{
path: 'sub-sub-page2',
name: '一二级列表页面',
icon: ,
},
{
path: 'sub-sub-page3',
name: '一三级列表页面',
icon: ,
},
],
},
{
path: '/list/sub-page2',
name: '二级列表页面',
icon: ,
},
{
path: '/list/sub-page3',
name: '三级列表页面',
icon: ,
},
],
},
{
path: 'https://ant.design',
name: 'Ant Design 官网外链',
icon: ,
},
],
},
};

export default props;

```

Contributor guide

Open the contributing guide

Research direction

The issue provides a ProLayoutProps route configuration and React.lazy entry points but names no repository files or tests. Start by reading the ProLayout route handling and the ReactRouter integration, then document a configuration that produces working navigation links, menus, and breadcrumbs without Umi.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.