import React , { lazy } from 'react' ; import BlogLayout from '@shared/BlogLayout' ; export interface RouterMenuItem { path : string ; icon ? : string ; component : React . FC < any > ; title ? : string ; children ? : RouterMenuItem [ ] ; isPrivate ? : boolean ; } const ArticleList = lazy ( ( ) => import ( '@views/ArticleList' ) ) ; const ArticleDetail = lazy ( ( ) => import ( '@views/ArticleDetail' ) ) ; const AboutMe = lazy ( ( ) => import ( '@views/AboutMe' ) ) ; const Tags = lazy ( ( ) => import ( '@views/Tags' ) ) ; const Login = lazy ( ( ) => import ( '@views/Login' ) ) ; const Admin = lazy ( ( ) => import ( '@views/Admin' ) ) ; const AddArticle = lazy ( ( ) => import ( '@views/Admin/AddArticle' ) ) ; const ArticleManager = lazy ( ( ) => import ( '@views/Admin/ArticleManager' ) ) ; const UserManager = lazy ( ( ) => import ( '@views/Admin/UserManager' ) ) ; const TagWithArticle = lazy ( ( ) => import ( '@views/TagWithArticle' ) ) ; export const homeMenu = { path : '/' , component : BlogLayout , children : [ { path : '/' , title : '首页' , component : ArticleList , icon : 'home' } , { path : '/tag' , title : '标签' , component : Tags , icon : 'tags' } , { path : '/about' , title : '关于' , component : AboutMe , icon : 'user' } , { path : '/tag/:tag' , component : TagWithArticle } , { path : 'article-detail/:id' , component : ArticleDetail } ] } ; export const adminMenu = { path : 'admin' , component : Admin , children : [ { path : '' , title : '文章管理' , component : ArticleManager , icon : 'home' } , { path : 'add' , title : '添加文章' , component : AddArticle , icon : 'edit' } , { path : 'user' , title : '用户管理' , component : UserManager , icon : 'user' } ] } ; const menu = [ { path : 'login' , component : Login } , adminMenu , homeMenu ] ; export default menu ;