Use vue-router to set the title method for each page.
Basic Environment configuration: webpack + vue2.0 + vue-router + nodeJS
Go to the index. js file under the router folder.
First introduce:
import Vue from 'vue'import Router from 'vue-router'
Then configure the address of each route in the route:
Routes: [{/* (homepage) default route address */path: '/', name: 'enables', component: Entrance, meta: {title: 'homepage entry '}},{/* modify nickName */path:'/modifyName/: nickname', name: 'modifyname', component: modifyName, meta: {title: 'modify nickname '}, {/* product details */path:'/goodsDetail ', name: 'goodsdetail', component: goodsDetail, meta: {title: 'item details' }},{/* Not Found route, must be the last route */path: '*', component: NotFound, meta: {title: 'page not found '}]
Set the title name of the page in each meta.
Router. beforeEach (to, from, next) =>{/* modify the page title */if (. meta. title) {document. title =. meta. title} next ()})
In this way, the title is added to every VUE page.
The above method of setting the title of each page by using vue-router is all the content shared by Alibaba Cloud. I hope you can give us a reference and support for the customer's house.