vue中的进度条

①首先需要安装依赖 
npm install --save nprogress
如果是vue cli3 需要在 依赖中 安装 nprogress 即可
②使用
 一: 首先要在router文件的index.js中引入需要的包
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
二:使用 在导航守卫中使用
router.beforeEach((to, from, next) => {
  NProgress.start()
  next()
})

router.afterEach(() => {
  NProgress.done()
})
三: 改变颜色
在app.vue中设置即可
 #nprogress .bar {
      background: red !important; //自定义颜色
    }
 
 
 
原文地址:https://www.cnblogs.com/maxiag/p/13230389.html