add 处理页面标题

This commit is contained in:
赵霄
2023-12-07 14:18:14 +08:00
parent 8aa45a66f5
commit b71236ba06
2 changed files with 8 additions and 1 deletions
+5 -1
View File
@@ -52,9 +52,13 @@ export default {
},
// 导航标题(国际化)
pageTitle () {
if (!this.$route.meta.pageTitle) {
if (!this.$route.meta.pageTitle && !this.$route.meta.title) {
return ''
}
// 路由守卫处理了把taskName赋值给title了
if (this.$route.meta.title) {
return this.$route.meta.title
}
return this.$t('pageTitle.' + this.$route.meta.pageTitle)
},
// 是否白色头部导航
+3
View File
@@ -26,6 +26,9 @@ router.beforeEach(async (to, from, next) => {
if (to.path === '/user/login') {
next('/')
} else {
if (to.query.taskName) {
to.meta.title = to.query.taskName
}
next()
}
} else {