添加个人中心遮罩,添加自动更改title功能

This commit is contained in:
pixel
2020-12-09 16:30:06 +08:00
parent e102f820c1
commit 9a4667fa46
3 changed files with 40 additions and 11 deletions

View File

@@ -1,5 +1,6 @@
import router from './router'
import { store } from '@/store/index'
import getPageTitle from '@/utils/page'
let asyncRouterFlag = 0
@@ -8,6 +9,8 @@ const whiteList = ['login']
router.beforeEach(async(to, from, next) => {
const token = store.getters['user/token']
// 在白名单中的判断情况
//修改网页标签名称
document.title = getPageTitle(to.meta.title)
if (whiteList.indexOf(to.name) > -1) {
if (token) {
next({ path: '/layout/dashboard' })