在需要使用的地方引入,我的是在有router.beforeEach的地方使用的
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
NProgress.configure({showSpinner:false})
router.beforeEach(()=>{
NProgress.start()
})
router.afterEach(()=>{
NProgress.done()
})
方法
NProgress.start() — shows the progress bar
NProgress.set(0.4) — sets a percentage
NProgress.inc() — increments by a little
NProgress.done() — completes the progress
网友评论