官网:http://ricostacruz.com/nprogress/
github:https://github.com/rstacruz/nprogress
1、安装
$ npm install --save nprogress 或者
$ yarn add nprogress
```javascript
//1.下载依赖 cnpm i nprogress -S
//2.在main.js或者router.js
import router from './router'
Vue.use(VueRouter)
//引入nprogress
import NProgress from 'nprogress'
import 'nprogress/nprogress.css' //这个样式必须引入
// 简单配置
NProgress.inc(0.2)
NProgress.configure({ easing: 'ease', speed: 500, showSpinner: false })
router.beforeEach((to,from,next) => {
NProgress.start()
next()
})
router.afterEach(() => {
NProgress.done()
})