fix: 修复页面标题重复显示问题

将 document.title 从 ' - 智教助手' 改为条件判断,
首页等无标题页面只显示'智教助手',其他页面显示'标题 - 智教助手'
This commit is contained in:
Zhang Jing Xuan
2026-07-31 17:34:48 +08:00
parent bb51fb34e2
commit c9b5785301
+1 -1
View File
@@ -81,7 +81,7 @@ router.beforeEach((to, _from, next) => {
const token = localStorage.getItem('access_token') const token = localStorage.getItem('access_token')
const publicPaths = ['/login', '/preview'] const publicPaths = ['/login', '/preview']
const isPublic = Boolean(to.meta.public) || publicPaths.some(p => to.path.startsWith(p)) const isPublic = Boolean(to.meta.public) || publicPaths.some(p => to.path.startsWith(p))
document.title = `${to.meta.title || '智教助手'} - 智教助手` document.title = to.meta.title ? `${to.meta.title} - 智教助手` : '智教助手'
if (!isPublic && !token) { if (!isPublic && !token) {
next({ path: '/login', query: { redirect: to.fullPath } }) next({ path: '/login', query: { redirect: to.fullPath } })