feat(sj_1.0.0): useTitle 加上站点名
This commit is contained in:
parent
a6e49d21a2
commit
4ec53d3c35
@ -2,12 +2,14 @@ import { useTitle } from '@vueuse/core';
|
||||
import type { Router } from 'vue-router';
|
||||
import { $t } from '@/locales';
|
||||
|
||||
const { VITE_APP_TITLE } = import.meta.env;
|
||||
|
||||
export function createDocumentTitleGuard(router: Router) {
|
||||
router.afterEach(to => {
|
||||
const { i18nKey, title } = to.meta;
|
||||
|
||||
const documentTitle = i18nKey ? $t(i18nKey) : title;
|
||||
|
||||
useTitle(documentTitle);
|
||||
useTitle(documentTitle, { titleTemplate: `%s | ${VITE_APP_TITLE}` });
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user