import LayOut from '../layout/index' import { Suspense, lazy } from 'react' import Loading from '../Loading' import RouteInterception from './RouteInterception' import Notfound from '../Notfound' // interface Meta { // title: string, // redirect?: boolean // } type route = { path: string, element: any, meta?: any, children?: Array } const lazyLoad = (viewName: string) => { if(viewName === 'login') { const LoginView = lazy(()=>import('../Login')) return } if(viewName === 'home') { const Home = lazy(()=>import('../view/home')) return } const View = lazy(()=>import(`../view/${viewName}.tsx`)) return } // 常驻路由 const currentRouter: Array = [ { path: '/', element: , children: [ { path: "", //登录后默认跳转路径 element : }>{lazyLoad('home')} }, { path: "*", element: } ] }, { path: '/login', element: }>{lazyLoad('login')} } ] export default currentRouter