mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-28 06:06:42 +08:00
feat(projects): global add page title suffix
This commit is contained in:
parent
531432d5ff
commit
5fcf89c915
@ -8,6 +8,12 @@ export function createDocumentTitleGuard(router: Router) {
|
|||||||
|
|
||||||
const documentTitle = i18nKey ? $t(i18nKey) : title;
|
const documentTitle = i18nKey ? $t(i18nKey) : title;
|
||||||
|
|
||||||
useTitle(documentTitle);
|
changeDocumentTitle(documentTitle);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function changeDocumentTitle(documentTitle: string) {
|
||||||
|
useTitle(documentTitle, {
|
||||||
|
titleTemplate: `%s | ${import.meta.env.VITE_APP_TITLE}`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import { effectScope, nextTick, onScopeDispose, ref, watch } from 'vue';
|
import { effectScope, nextTick, onScopeDispose, ref, watch } from 'vue';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { breakpointsTailwind, useBreakpoints, useEventListener, useTitle } from '@vueuse/core';
|
import { breakpointsTailwind, useBreakpoints, useEventListener } from '@vueuse/core';
|
||||||
import { useBoolean } from '@sa/hooks';
|
import { useBoolean } from '@sa/hooks';
|
||||||
import { SetupStoreId } from '@/enum';
|
import { SetupStoreId } from '@/enum';
|
||||||
import { router } from '@/router';
|
import { router } from '@/router';
|
||||||
import { $t, setLocale } from '@/locales';
|
import { $t, setLocale } from '@/locales';
|
||||||
import { setDayjsLocale } from '@/locales/dayjs';
|
import { setDayjsLocale } from '@/locales/dayjs';
|
||||||
import { localStg } from '@/utils/storage';
|
import { localStg } from '@/utils/storage';
|
||||||
|
import { changeDocumentTitle } from '@/router/guard/title';
|
||||||
import { useRouteStore } from '../route';
|
import { useRouteStore } from '../route';
|
||||||
import { useTabStore } from '../tab';
|
import { useTabStore } from '../tab';
|
||||||
import { useThemeStore } from '../theme';
|
import { useThemeStore } from '../theme';
|
||||||
@ -73,7 +74,7 @@ export const useAppStore = defineStore(SetupStoreId.App, () => {
|
|||||||
|
|
||||||
const documentTitle = i18nKey ? $t(i18nKey) : title;
|
const documentTitle = i18nKey ? $t(i18nKey) : title;
|
||||||
|
|
||||||
useTitle(documentTitle);
|
changeDocumentTitle(documentTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
Loading…
Reference in New Issue
Block a user