feature: change page title when route change (#1910)

This commit is contained in:
非空
2019-04-15 11:58:43 +08:00
committed by 花裤衩
parent 14580da5b3
commit 26d0f40df2
6 changed files with 37 additions and 10 deletions

View File

@@ -4,6 +4,7 @@ import { Message } from 'element-ui'
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css' // progress bar style
import { getToken } from '@/utils/auth' // get token from cookie
import getPageTitle from '@/utils/get-page-title'
NProgress.configure({ showSpinner: false }) // NProgress Configuration
@@ -13,6 +14,9 @@ router.beforeEach(async(to, from, next) => {
// start progress bar
NProgress.start()
// set page title
document.title = getPageTitle(to.meta.title)
// determine whether the user has logged in
const hasToken = getToken()