NProgress是頁面跳轉是出現在瀏覽器頂部的進度條 官網:http://ricostacruz.com/nprogress/ github:https://github.com/rstacruz/nprogress

1、安裝
$ npm install --save nprogress 或者
$ yarn add nprogress
//用法
NProgress.start();
NProgress.done();
2、使用
router.js //導入 import NProgress from 'nprogress' import 'nprogress/nprogress.css' router.beforeEach((to, from, next) => { NProgress.start() next() }) router.afterEach(() => { NProgress.done() })
3、顏色值更改
在App.vue中的style中增加:
#nprogress .bar { background: red !important; //自定義顏色 }
