Show page title
This commit is contained in:
parent
548b65557b
commit
28dcf69c42
|
@ -3,6 +3,9 @@
|
||||||
"lang": {
|
"lang": {
|
||||||
"es": "Spanish",
|
"es": "Spanish",
|
||||||
"en": "English"
|
"en": "English"
|
||||||
|
},
|
||||||
|
"pages": {
|
||||||
|
"logIn": "Log In"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
|
|
|
@ -3,6 +3,12 @@
|
||||||
"lang": {
|
"lang": {
|
||||||
"es": "Español",
|
"es": "Español",
|
||||||
"en": "Inglés"
|
"en": "Inglés"
|
||||||
|
},
|
||||||
|
"pages": {
|
||||||
|
"logIn": "Iniciar sesión",
|
||||||
|
"dashboard": "Portada",
|
||||||
|
"customers": "Clientes",
|
||||||
|
"customerList": "Listado de clientes",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
|
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
|
||||||
import { useSession } from '@/core/composables/useSession';
|
import { useSession } from '@/core/composables/useSession';
|
||||||
|
import i18n from '@/i18n';
|
||||||
|
|
||||||
const routes: Array<RouteRecordRaw> = [
|
const routes: Array<RouteRecordRaw> = [
|
||||||
{
|
{
|
||||||
path: '/login',
|
path: '/login',
|
||||||
name: 'Login',
|
name: 'Login',
|
||||||
|
meta: { title: 'logIn' },
|
||||||
component: () => import('../views/Login/Login.vue'),
|
component: () => import('../views/Login/Login.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -16,17 +18,20 @@ const routes: Array<RouteRecordRaw> = [
|
||||||
{
|
{
|
||||||
path: '/dashboard',
|
path: '/dashboard',
|
||||||
name: 'Dashboard',
|
name: 'Dashboard',
|
||||||
|
meta: { title: 'dashboard' },
|
||||||
component: () => import('../views/Dashboard/Dashboard.vue'),
|
component: () => import('../views/Dashboard/Dashboard.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/customer',
|
path: '/customer',
|
||||||
name: 'Customer',
|
name: 'Customer',
|
||||||
|
meta: { title: 'customers' },
|
||||||
component: () => import('../views/Customer/Customer.vue'),
|
component: () => import('../views/Customer/Customer.vue'),
|
||||||
redirect: { name: 'List' },
|
redirect: { name: 'List' },
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'list',
|
path: 'list',
|
||||||
name: 'List',
|
name: 'List',
|
||||||
|
meta: { title: 'customerList' },
|
||||||
component: () => import('../views/Customer/List.vue'),
|
component: () => import('../views/Customer/List.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -61,4 +66,20 @@ router.beforeEach((to, from, next) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.afterEach((to) => {
|
||||||
|
interface Meta {
|
||||||
|
title?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { t } = i18n.global;
|
||||||
|
|
||||||
|
const childMeta: Meta = to.meta;
|
||||||
|
if (childMeta && childMeta.title) {
|
||||||
|
//const parent = to.matched[1];
|
||||||
|
//const childTitle: string = childMeta.title;
|
||||||
|
|
||||||
|
document.title = t(`globals.pages.${childMeta.title}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|
Loading…
Reference in New Issue