在router的index.js加入meta
meta: {
title: '首页'
}
在main.js加入路由守卫
router.beforeEach((to, from, next) => {
// to去哪 from 来自
if (to.meta.title) {
document.title = to.meta.title
}
next()
})
在router的index.js加入meta
meta: {
title: '首页'
}
在main.js加入路由守卫
router.beforeEach((to, from, next) => {
// to去哪 from 来自
if (to.meta.title) {
document.title = to.meta.title
}
next()
})