feat: 网页title根据路由动态变化
This commit is contained in:
@@ -14,4 +14,11 @@ const router = createRouter({
|
||||
}
|
||||
},
|
||||
})
|
||||
router.beforeEach((to, from, next) => {
|
||||
if (to.meta.title && to.meta.title != '') {
|
||||
let oldTitle = document.title
|
||||
document.title = <string>to.meta.title + ' - ' + oldTitle
|
||||
}
|
||||
next()
|
||||
})
|
||||
export default router
|
||||
|
||||
Reference in New Issue
Block a user