feat: only start nprogress when to from different (#318)

This commit is contained in:
云游君 authored and GitHub committed 2022-03-23 19:14:02 +08:00
1 parent f1af7424e2
commit d0f6274ac4
1 file changed
+4 -1
+4 -1
View File
@@ -3,7 +3,10 @@ import type { UserModule } from '~/types'
export const install: UserModule = ({ isClient, router }) => { export const install: UserModule = ({ isClient, router }) => {
if (isClient) { if (isClient) {
router.beforeEach(() => { NProgress.start() }) router.beforeEach((to, from) => {
if (to.path !== from.path)
NProgress.start()
})
router.afterEach(() => { NProgress.done() }) router.afterEach(() => { NProgress.done() })
} }
} }