修改 title

This commit is contained in:
mmc
2026-11-06 09:37:48 +08:00
parent 3f660c75dd
commit d43d44c502
13 changed files with 34 additions and 25 deletions

View File

@@ -9,7 +9,8 @@ import { useTranslation } from 'react-i18next';
import { I18nextProvider } from 'react-i18next';
import i18n from './i18n';
import { useEffect } from 'react';
import { useAppDispatch } from './store';
import { useSelector } from 'react-redux';
import { useAppDispatch, type RootState } from './store';
import { setSettingField, setGlobalParams } from './store/basicSettingsSlice';
import { getSystemParam } from './api/global';
@@ -56,6 +57,12 @@ const AntdConfigWrapper = ({ children }: { children: React.ReactNode }) => {
export default function App() {
const dispatch = useAppDispatch();
// 系统名称与页面标题保持一致:优先使用接口下发/本地缓存的 systemName
const systemName = useSelector((state: RootState) => state.basicSettings.systemName);
useEffect(() => {
if (systemName) document.title = systemName;
}, [systemName]);
useEffect(() => {
getSystemParam()
.then((res: any) => {