在h5中,跳转页面会显示不同的页面标题。
routes: [
{
path: '/',
name: 'Entrance',
component: Entrance,
meta: {
title: '首页入口'
}
}
]
router.beforeEach((to, from, next) => {
/* 路由发生变化修改页面title */
if (to.meta.title) {
document.title = to.meta.title
}
next()
})
在路由里面的meta里面增加一个title,全局路由守卫去改变页面的标题