修复页面标题 fix 256, 修改 ql update 依赖安装逻辑

This commit is contained in:
hanhh
2021-06-07 00:57:57 +08:00
parent a8707e5422
commit 7f1c55c40a
8 changed files with 9851 additions and 10 deletions
+19
View File
@@ -2,6 +2,18 @@ import { history } from 'umi';
import { request } from '@/utils/http';
import config from '@/utils/config';
const titleMap: any = {
'/': '控制面板',
'/login': '登录',
'/crontab': '定时任务',
'/cookie': 'Session管理',
'/config': '配置文件',
'/diy': '自定义脚本',
'/diff': '对比工具',
'/log': '日志',
'/setting': '系统设置',
};
export function render(oldRender: any) {
request
.get(`${config.apiPrefix}user`)
@@ -22,3 +34,10 @@ export function render(oldRender: any) {
}
});
}
export function onRouteChange({ matchedRoutes }: any) {
if (matchedRoutes.length) {
const path: string = matchedRoutes[matchedRoutes.length - 1].route.path;
document.title = `${titleMap[path]} - 控制面板`;
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

+1 -1
View File
@@ -13,7 +13,7 @@ export default {
route: {
routes: [
{
name: 'login',
name: '登录',
path: '/login',
hideInMenu: true,
component: '@/pages/login/index',
+1
View File
@@ -95,6 +95,7 @@ export default function (props: any) {
},
];
}}
pageTitleRender={() => '控制面板'}
{...defaultProps}
>
{props.children}