mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-16 17:09:20 +08:00
修复页面标题 fix 256, 修改 ql update 依赖安装逻辑
This commit is contained in:
+19
@@ -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 |
@@ -13,7 +13,7 @@ export default {
|
||||
route: {
|
||||
routes: [
|
||||
{
|
||||
name: 'login',
|
||||
name: '登录',
|
||||
path: '/login',
|
||||
hideInMenu: true,
|
||||
component: '@/pages/login/index',
|
||||
|
||||
@@ -95,6 +95,7 @@ export default function (props: any) {
|
||||
},
|
||||
];
|
||||
}}
|
||||
pageTitleRender={() => '控制面板'}
|
||||
{...defaultProps}
|
||||
>
|
||||
{props.children}
|
||||
|
||||
Reference in New Issue
Block a user