permission.js 572 B

1234567891011121314151617181920212223
  1. import router from './router'
  2. // import store from './store'
  3. // import { Message } from 'element-ui'
  4. import NProgress from 'nprogress' // progress bar
  5. import 'nprogress/nprogress.css' // progress bar style
  6. import getPageTitle from '@/utils/get-page-title'
  7. NProgress.configure({ showSpinner: false }) // NProgress Configuration
  8. router.beforeEach(async(to, from, next) => {
  9. // start progress bar
  10. NProgress.start()
  11. // set page title
  12. document.title = getPageTitle(to.meta.title)
  13. next()
  14. })
  15. router.afterEach(() => {
  16. // finish progress bar
  17. NProgress.done()
  18. })