1 | import Vue from 'vue'
|
2 | import nprogress from 'nprogress'
|
3 |
|
4 | export default {
|
5 | mounted () {
|
6 | // configure progress bar
|
7 | nprogress.configure({ showSpinner: false })
|
8 |
|
9 | this.$router.beforeEach((to, from, next) => {
|
10 | if (to.path !== from.path && !Vue.component(to.name)) {
|
11 | nprogress.start()
|
12 | }
|
13 | next()
|
14 | })
|
15 |
|
16 | this.$router.afterEach(() => {
|
17 | nprogress.done()
|
18 | this.isSidebarOpen = false
|
19 | })
|
20 | }
|
21 | }
|