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

This commit is contained in:
云游君 2022-03-23 19:14:02 +08:00 committed by GitHub
parent f1af7424e2
commit d0f6274ac4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,10 @@ import type { UserModule } from '~/types'
export const install: UserModule = ({ isClient, router }) => {
if (isClient) {
router.beforeEach(() => { NProgress.start() })
router.beforeEach((to, from) => {
if (to.path !== from.path)
NProgress.start()
})
router.afterEach(() => { NProgress.done() })
}
}