18 lines
512 B
TypeScript
18 lines
512 B
TypeScript
import defaultSettings from '@/settings';
|
|
import { useSettingsStore } from '@/store/modules/settings';
|
|
|
|
/**
|
|
* 动态修改标题
|
|
*/
|
|
export const useDynamicTitle = () => {
|
|
const settingsStore = useSettingsStore();
|
|
const pageTitle = settingsStore.title || (defaultSettings.title as string);
|
|
const appTitle = settingsStore.appTitle || (defaultSettings.title as string);
|
|
|
|
if (settingsStore.dynamicTitle) {
|
|
document.title = `${pageTitle} - ${appTitle}`;
|
|
} else {
|
|
document.title = appTitle;
|
|
}
|
|
};
|