修改 title
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user