优化
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
import defaultSettings from '@/settings';
|
||||
import { useSettingsStore } from '@/store/modules/settings';
|
||||
import i18n from '@/lang';
|
||||
import { translateRouteTitle } from '@/utils/i18n';
|
||||
|
||||
/**
|
||||
* 动态修改标题
|
||||
*/
|
||||
export const useDynamicTitle = () => {
|
||||
const settingsStore = useSettingsStore();
|
||||
const appTitle = i18n.global.t('app.title');
|
||||
if (settingsStore.dynamicTitle) {
|
||||
document.title = settingsStore.title + ' - ' + import.meta.env.VITE_APP_TITLE;
|
||||
document.title = translateRouteTitle(settingsStore.title) + ' - ' + appTitle;
|
||||
} else {
|
||||
document.title = defaultSettings.title as string;
|
||||
document.title = appTitle || (defaultSettings.title as string);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user