1. Problem background: customer service feedback, some functional pages in the customer service system (pages under "Account Service" and user information, order details pages) do not display names in the navigation bar.
2. Analysis: Observe the routing under the router.js file
3. Solution: Add routing guards
// 路由前置导航守卫
router.beforeEach((to, from, next) => {
// 根据路由元信息设置文档标题
window.document.title = to.meta.title || admin
next()
})
or
router.beforeEach((to,from,next) => {
/* 路由发生变化修改页面title */
if(to.meta.title){
window.document.title = to.meta.title;
}
next();
})