Optimize tools route. Optimize multiple menu stylesheet.

This commit is contained in:
2023-10-12 01:51:56 +08:00
parent 41b0cb6d3e
commit bc82572fa8
6 changed files with 196 additions and 100 deletions

106
src/router/tools.tsx Normal file
View File

@@ -0,0 +1,106 @@
import React from 'react'
const toolsJsonObjects: ToolsJsonObject[] = [
{
path: '',
id: 'tools',
component: React.lazy(() => import('@/pages/tools')),
name: '主页',
icon: React.lazy(() => import('~icons/fatweb/logo.jsx')),
menu: true,
auth: false
},
{
path: 'all',
id: 'tools-all',
component: React.lazy(() => import('@/pages/tools')),
name: '全部工具',
icon: React.lazy(() => import('~icons/fatweb/logo.jsx')),
menu: true,
auth: false
},
{
path: 'translation',
id: 'tools-translation',
component: React.lazy(() => import('@/pages/tools/Translation')),
name: '翻译',
icon: React.lazy(() => import('~icons/fatweb/jenkins.jsx')),
menu: true,
auth: false,
children: [
{
path: '1',
id: '1',
name: '翻译1',
menu: true,
auth: false
},
{
path: '2',
id: '2',
name: '翻译2',
menu: true,
auth: false
}
]
},
{
path: 'translation-',
id: 'tools-translation-',
component: React.lazy(() => import('@/pages/tools/Translation')),
name: '翻译-',
icon: React.lazy(() => import('~icons/fatweb/jenkins.jsx')),
menu: true,
auth: false,
children: [
{
path: '1-',
id: '1-',
name: '翻译1-',
menu: true,
auth: false
},
{
path: '2-',
id: '2-',
name: '翻译2-',
menu: true,
auth: false
}
]
},
{
path: 'translation--',
id: 'tools-translation--',
component: React.lazy(() => import('@/pages/tools/Translation')),
name: '翻译--',
icon: React.lazy(() => import('~icons/fatweb/jenkins.jsx')),
menu: true,
auth: false
}
]
const tools: RouteObject[] = toolsJsonObjects.map((value) => ({
path: value.path,
id: value.id,
Component: value.component,
handle: {
name: value.name,
icon: value.icon,
menu: value.menu,
auth: value.auth
},
children: value.children?.map((value) => ({
path: value.path,
id: value.id,
Component: value.component,
handle: {
name: value.name,
icon: value.icon,
menu: value.menu,
auth: value.auth
}
}))
}))
export default tools