import { Navigate, RouteObject } from 'react-router'
import { RouteConfig } from '@/core/Router/type'
import { lazy } from 'react'
import {
BoldOutlined,
WifiOutlined,
ThunderboltOutlined,
CalendarOutlined
} from '@ant-design/icons'
import { lazyLoad } from '@/core/Router/utils'
const routes: RouteConfig[] = [
{
path: '/*',
element: lazyLoad(lazy(() => import('@/core/Layout'))),
children: [
{
index: true,
element:
},
{
path: 'parent',
name: '仅在左边显示',
icon: ,
layout: {
topItemRender: false
},
children: [
{
path: 'child1',
name: '子组件1',
keepAlive: true,
element: lazyLoad(lazy(() => import('@/pages/Parent/Child1')))
},
{
path: 'child2',
name: '子组件2',
element: lazyLoad(lazy(() => import('@/pages/Parent/Child2')))
}
]
},
{
path: 'head',
name: '仅在头部显示',
icon: ,
layout: {
leftItemRender: false
},
children: [
{
path: 'head1',
name: '头部1',
element:
头部1
},
{
path: 'head2',
name: '头部2',
element: 头部2
}
]
},
{
path: 'leftAndHead',
name: '左侧和头部都显示',
icon: ,
children: [
{
path: 'common1',
name: '共有1',
element: 共有1
},
{
path: 'common2',
name: '共有2',
element: 共有2
}
]
},
{
path: 'analyse',
name: '数据看板',
icon: ,
children: [
{
path: 'sell',
name: '销售数据',
element: lazyLoad(lazy(() => import('@/pages/Analyse/Sell')))
},
{
path: 'user',
name: '用户统计',
element: lazyLoad(lazy(() => import('@/pages/Analyse/User')))
}
]
}
]
},
{
path: 'login',
element: lazyLoad(lazy(() => import('@/pages/Login')))
},
{
path: '/403',
element: 无权限
},
{ path: '*', element: lazyLoad(lazy(() => import('@/pages/NotFound'))) }
]
export default routes as RouteObject[]