Added page title function for Composition API components.

This commit is contained in:
DebaucheryLibrarian
2023-06-24 22:30:55 +02:00
parent fdad61465c
commit 6de6053eaa
3 changed files with 22 additions and 6 deletions

View File

@@ -1,5 +1,7 @@
import { createRouter, createWebHistory } from 'vue-router';
import setPageTitle from './set-page-title';
import Home from '../components/home/home.vue';
import Login from '../components/auth/login.vue';
import Signup from '../components/auth/signup.vue';
@@ -257,11 +259,17 @@ const routes = [
path: '/stats',
component: Stats,
name: 'stats',
meta: {
title: 'Stats',
},
},
{
path: '/not-found',
name: 'not-found',
component: NotFound,
meta: {
title: 'Not Found',
},
},
{
path: '/:catchAll(.*)',
@@ -276,4 +284,6 @@ const router = createRouter({
routes,
});
router.beforeEach((to) => setPageTitle(to.meta.title));
export default router;