[U] Titles
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
<meta content="IE=edge" http-equiv="X-UA-Compatible">
|
<meta content="IE=edge" http-equiv="X-UA-Compatible">
|
||||||
<meta content="width=device-width,initial-scale=1.0" name="viewport">
|
<meta content="width=device-width,initial-scale=1.0" name="viewport">
|
||||||
<link href="<%= BASE_URL %>favicon.ico" rel="icon">
|
<link href="<%= BASE_URL %>favicon.ico" rel="icon">
|
||||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
<title>Home</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>
|
<noscript>
|
||||||
|
|||||||
@@ -51,6 +51,13 @@ export default class App extends Vue
|
|||||||
|
|
||||||
updateBookmark(to: RouteLocationNormalized): void
|
updateBookmark(to: RouteLocationNormalized): void
|
||||||
{
|
{
|
||||||
|
// Update title
|
||||||
|
// Use next tick to handle router history correctly
|
||||||
|
// see: https://github.com/vuejs/vue-router/issues/914#issuecomment-384477609
|
||||||
|
this.$nextTick(() => {
|
||||||
|
document.title = to.meta.title ? `Hykilpikonna - ${to.meta.title}` : 'Hykilpikonna - Home';
|
||||||
|
})
|
||||||
|
|
||||||
console.log('AfterEach called', to)
|
console.log('AfterEach called', to)
|
||||||
this.currentRoute = (to.name as string).toLowerCase()
|
this.currentRoute = (to.name as string).toLowerCase()
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,19 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
name: 'Home',
|
name: 'Home',
|
||||||
|
meta: {title: 'Home'},
|
||||||
component: Home
|
component: Home
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/new-home',
|
path: '/new-home',
|
||||||
name: 'New Home',
|
name: 'New Home',
|
||||||
|
meta: {title: 'Home'},
|
||||||
component: () => import('../views/NewHome.vue')
|
component: () => import('../views/NewHome.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/about',
|
path: '/about',
|
||||||
name: 'About',
|
name: 'About',
|
||||||
|
meta: {title: 'About Me'},
|
||||||
// route level code-splitting
|
// route level code-splitting
|
||||||
// this generates a separate chunk (about.[hash].js) for this route
|
// this generates a separate chunk (about.[hash].js) for this route
|
||||||
// which is lazy-loaded when the route is visited.
|
// which is lazy-loaded when the route is visited.
|
||||||
@@ -23,16 +26,19 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
{
|
{
|
||||||
path: '/life',
|
path: '/life',
|
||||||
name: 'Life',
|
name: 'Life',
|
||||||
|
meta: {title: 'Life'},
|
||||||
component: () => import('../views/Life.vue')
|
component: () => import('../views/Life.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/color',
|
path: '/color',
|
||||||
name: 'ColorPicker',
|
name: 'ColorPicker',
|
||||||
|
meta: {title: 'Color Picker'},
|
||||||
component: () => import('../components/color/ColorPickerTest.vue')
|
component: () => import('../components/color/ColorPickerTest.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/projects',
|
path: '/projects',
|
||||||
name: 'Projects',
|
name: 'Projects',
|
||||||
|
meta: {title: 'Projects'},
|
||||||
component: () => import('../views/Projects.vue')
|
component: () => import('../views/Projects.vue')
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user