模版引入的文件
This commit is contained in:
parent
df892bb2e0
commit
e914ac09d1
|
|
@ -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)}
|
||||
|
|
|
|||
|
|
@ -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)}
|
||||
|
|
|
|||
|
|
@ -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) {
|
|||
<Route
|
||||
key={`route_${namespace ? `${namespace}_` : ''}${index}`}
|
||||
path={path}
|
||||
element={
|
||||
<React.Suspense fallback={<Loading />}>
|
||||
<Component namespace={namespace} />
|
||||
</React.Suspense>
|
||||
}
|
||||
element={<Component namespace={namespace} />}
|
||||
></Route>
|
||||
);
|
||||
});
|
||||
|
|
@ -36,8 +31,7 @@ let routers: Router[] = [];
|
|||
|
||||
function App() {
|
||||
return (
|
||||
<React.Suspense>
|
||||
<Message />
|
||||
<AppContainer>
|
||||
<Routes>
|
||||
<Route path="/console" element={<Console />}>
|
||||
{getRoutes(routers, 'console')}
|
||||
|
|
@ -47,8 +41,7 @@ function App() {
|
|||
</Route>
|
||||
<Route path="*" element={<NotFound />} />
|
||||
</Routes>
|
||||
{process.env.NODE_ENV === 'development' && <DebugPanel />}
|
||||
</React.Suspense>
|
||||
</AppContainer>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<React.Suspense fallback={<Loading />}>
|
||||
<Message />
|
||||
{children}
|
||||
{process.env.NODE_ENV === 'development' && <DebugPanel />}
|
||||
</React.Suspense>
|
||||
);
|
||||
};
|
||||
|
||||
export default AppContainer;
|
||||
Loading…
Reference in New Issue