fix: 修复页面标题重复显示问题
将 document.title 从 ' - 智教助手' 改为条件判断, 首页等无标题页面只显示'智教助手',其他页面显示'标题 - 智教助手'
This commit is contained in:
@@ -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 } })
|
||||||
|
|||||||
Reference in New Issue
Block a user