After utilizing vue-cli with webpack to construct the vue project, I incorporated vue-meta-info for SEO purposes.
I am facing an issue in setting up the page title using templates and route names. Unfortunately, I am unable to access the variable in the router.
router/index.js
import Vue from 'vue';
import Router from 'vue-router';
import HelloWorld from '@/components/HelloWorld';
Vue.use(Router);
export default new Router({
mode: 'history',
routes: [
{
path: '/',
name: 'HelloWorld',
component: HelloWorld,
},
],
});
App.vue
<template>
<div id="app">
<router-view/>
</div>
</template>
<script>
export default {
name: 'App',
metaInfo: {
title: "My Website - "+ route.name,
},
};
</script>