listpage_cli 0.0.243 → 0.0.245
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/backend-template/package.json.tmpl +1 -1
- package/templates/frontend-template/package.json.tmpl +1 -1
- package/templates/frontend-template/src/App.tsx.tmpl +17 -0
- package/templates/frontend-template/src/pages/.gitkeep +0 -0
- package/templates/frontend-template/src/router/menus.tsx +4 -11
- package/templates/package-app-template/package.json +1 -1
- package/templates/frontend-template/src/App.tsx +0 -9
- package/templates/frontend-template/src/pages/Home.tsx +0 -3
- package/templates/frontend-template/src/router/Layout.tsx +0 -28
- package/templates/frontend-template/src/router/index.tsx.tmpl +0 -14
package/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { App } from 'listpage-next/features/ReactApp';
|
|
2
|
+
import { menus } from './router/menus';
|
|
3
|
+
|
|
4
|
+
import './App.css';
|
|
5
|
+
|
|
6
|
+
export default () => {
|
|
7
|
+
return (
|
|
8
|
+
<App
|
|
9
|
+
basename="/__APP_NAME__"
|
|
10
|
+
icon={<span>Logo</span>}
|
|
11
|
+
title="Next Page"
|
|
12
|
+
menus={menus}
|
|
13
|
+
hasAuth={() => true}
|
|
14
|
+
loginElement={<div>登录页</div>}
|
|
15
|
+
/>
|
|
16
|
+
);
|
|
17
|
+
};
|
|
File without changes
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
import { MenuItem
|
|
2
|
-
import { basename } from '.';
|
|
1
|
+
import { MenuItem } from 'listpage-next';
|
|
3
2
|
|
|
4
3
|
export const menus: MenuItem[] = [
|
|
5
4
|
{
|
|
6
5
|
key: 'menu1',
|
|
7
6
|
label: '菜单一',
|
|
7
|
+
element: <div>菜单一的内容</div>
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
key: 'menu2',
|
|
11
11
|
label: '菜单二',
|
|
12
|
+
element: <div>菜单二的内容</div>
|
|
12
13
|
},
|
|
13
|
-
];
|
|
14
|
-
|
|
15
|
-
export const getDefaultMenu = () => {
|
|
16
|
-
let pathname = window.location.pathname;
|
|
17
|
-
if (pathname.startsWith(`/${basename}`)) {
|
|
18
|
-
pathname = pathname.slice(basename.length + 2);
|
|
19
|
-
}
|
|
20
|
-
return detectActiveMenu(pathname, menus);
|
|
21
|
-
};
|
|
14
|
+
];
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Menu, PageLayout } from 'listpage-next';
|
|
2
|
-
import React, { useMemo } from 'react';
|
|
3
|
-
import { Outlet, useNavigate } from 'react-router-dom';
|
|
4
|
-
import { OpenAIOutlined } from '@ant-design/icons';
|
|
5
|
-
|
|
6
|
-
import { getDefaultMenu, menus } from './menus';
|
|
7
|
-
|
|
8
|
-
export const Layout: React.FC = () => {
|
|
9
|
-
const navigate = useNavigate();
|
|
10
|
-
const defaultActiveKey = useMemo(getDefaultMenu, [location.pathname]);
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<PageLayout
|
|
14
|
-
logo={{
|
|
15
|
-
icon: <OpenAIOutlined />,
|
|
16
|
-
title: 'AI中心',
|
|
17
|
-
}}
|
|
18
|
-
sider={
|
|
19
|
-
<Menu
|
|
20
|
-
items={menus}
|
|
21
|
-
defaultActiveKey={defaultActiveKey}
|
|
22
|
-
onSelect={(path) => navigate(path)}
|
|
23
|
-
/>
|
|
24
|
-
}
|
|
25
|
-
content={<Outlet />}
|
|
26
|
-
/>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createBrowserRouter } from 'react-router-dom';
|
|
2
|
-
import { Layout } from './Layout';
|
|
3
|
-
|
|
4
|
-
export const basename = '__APP_NAME__';
|
|
5
|
-
|
|
6
|
-
export const router = createBrowserRouter([
|
|
7
|
-
{
|
|
8
|
-
path: '/',
|
|
9
|
-
element: <Layout />,
|
|
10
|
-
children: [],
|
|
11
|
-
},
|
|
12
|
-
], {
|
|
13
|
-
basename,
|
|
14
|
-
});
|