13 lines
372 B
TypeScript
13 lines
372 B
TypeScript
import { store, useAppStore } from "@/store";
|
|
import { Router } from "vue-router";
|
|
|
|
export function useTitleGuard(router: Router) {
|
|
router.beforeEach(function (to) {
|
|
const appStore = useAppStore(store);
|
|
const title = to.meta.title || appStore.title;
|
|
const subtitle = appStore.subtitle;
|
|
document.title = `${title} | ${subtitle}`;
|
|
});
|
|
return router;
|
|
}
|