diff --git a/lib/template.js b/lib/template.js index bbe2d22..6ec34be 100644 --- a/lib/template.js +++ b/lib/template.js @@ -465,9 +465,13 @@ function oakConfigContentWithWeChatMp() { exports.oakConfigContentWithWeChatMp = oakConfigContentWithWeChatMp; function appJsonContentWithWeb(isDev) { const pages = [ + '@project/pages/store/list/index', + '@project/pages/store/upsert/index', + '@project/pages/store/detail/index', '@project/pages/book/list/index', '@project/pages/book/upsert/index', '@project/pages/book/detail/index', + '@oak-general-business/pages/login/index', ]; return `{ "pages": ${JSON.stringify(pages, null, 4)} diff --git a/src/template.ts b/src/template.ts index 21907bd..0b683d2 100644 --- a/src/template.ts +++ b/src/template.ts @@ -476,9 +476,13 @@ export function oakConfigContentWithWeChatMp() { export function appJsonContentWithWeb(isDev: boolean) { const pages = [ + '@project/pages/store/list/index', + '@project/pages/store/upsert/index', + '@project/pages/store/detail/index', '@project/pages/book/list/index', '@project/pages/book/upsert/index', '@project/pages/book/detail/index', + '@oak-general-business/pages/login/index', ]; return `{ "pages": ${JSON.stringify(pages, null, 4)} diff --git a/template/web/src/App.tsx b/template/web/src/App.tsx index d178d57..f78053b 100644 --- a/template/web/src/App.tsx +++ b/template/web/src/App.tsx @@ -2,12 +2,11 @@ import React from 'react'; import { Routes, Route } from 'react-router-dom'; import './App.less'; -import Loading from './components/Loading'; +import AppContainer from './AppContainer'; + const Console = React.lazy(() => import('./components/console')); const Frontend = React.lazy(() => import('./components/frontend')); const NotFound = React.lazy(() => import('./components/notFound')); -const Message = React.lazy(() => import('@oak-general-business/components/message')); -const DebugPanel = React.lazy(() => import('@oak-general-business/components/func/debugPanel')); type Router = { path: string; @@ -22,11 +21,7 @@ function getRoutes(routers2: Router[], namespace?: string) { }> - - - } + element={} > ); }); @@ -36,8 +31,7 @@ let routers: Router[] = []; function App() { return ( - - + }> {getRoutes(routers, 'console')} @@ -47,8 +41,7 @@ function App() { } /> - {process.env.NODE_ENV === 'development' && } - + ); } diff --git a/template/web/src/AppContainer.tsx b/template/web/src/AppContainer.tsx new file mode 100644 index 0000000..052d5ed --- /dev/null +++ b/template/web/src/AppContainer.tsx @@ -0,0 +1,21 @@ +import React, { lazy } from 'react'; +import Loading from './components/Loading'; +const Message = lazy(() => import('@oak-general-business/components/message')); +const DebugPanel = lazy(() => import('@oak-general-business/components/func/debugPanel')); + +type AppContainerProps = { + children?: React.ReactNode +}; + +const AppContainer = (props: AppContainerProps) => { + const { children } = props; + return ( + }> + + {children} + {process.env.NODE_ENV === 'development' && } + + ); +}; + +export default AppContainer; \ No newline at end of file