一、安装
npm install --save nprogress
二.router.js
router.beforeEach(async (to, from, next) => {
NProgress.start()
})
router.afterEach((to, from) => {
afterEach(to, from)
NProgress.done()
});
router.onError((error) => {
NProgress.done();
//路由错误提示
});
效果图: