feat: 网页title根据路由动态变化

This commit is contained in:
taoran
2023-11-29 18:59:45 +08:00
parent a3f5cf6f2d
commit 7279a85274
7 changed files with 283 additions and 18 deletions
+7
View File
@@ -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