✨Add NProgress
This commit is contained in:
parent
adedafde03
commit
eda64c8483
7
package-lock.json
generated
7
package-lock.json
generated
@ -2288,7 +2288,7 @@
|
||||
},
|
||||
"@babel/types": {
|
||||
"version": "7.0.0-beta.35",
|
||||
"resolved": "https://registry.npm.taobao.org/@babel/types/download/@babel/types-7.0.0-beta.35.tgz?cache=0&sync_timestamp=1593521074992&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Ftypes%2Fdownload%2F%40babel%2Ftypes-7.0.0-beta.35.tgz",
|
||||
"resolved": "https://registry.npm.taobao.org/@babel/types/download/@babel/types-7.0.0-beta.35.tgz?cache=0&sync_timestamp=1588185770735&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Ftypes%2Fdownload%2F%40babel%2Ftypes-7.0.0-beta.35.tgz",
|
||||
"integrity": "sha1-z5M6mpo4SEynJLM1uI2Dcm1auWA=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
@ -8601,6 +8601,11 @@
|
||||
"set-blocking": "~2.0.0"
|
||||
}
|
||||
},
|
||||
"nprogress": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npm.taobao.org/nprogress/download/nprogress-0.2.0.tgz",
|
||||
"integrity": "sha1-y480xTIT2JVyP8urkH6UIq28r7E="
|
||||
},
|
||||
"nth-check": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "http://registry.npm.taobao.org/nth-check/download/nth-check-1.0.2.tgz",
|
||||
|
@ -24,6 +24,7 @@
|
||||
"lowdb": "^1.0.0",
|
||||
"marked": "^1.1.0",
|
||||
"node-sass": "^4.14.0",
|
||||
"nprogress": "^0.2.0",
|
||||
"plyr": "^3.6.2",
|
||||
"sass-loader": "^8.0.2",
|
||||
"v-viewer": "^1.5.1",
|
||||
|
@ -1,9 +1,11 @@
|
||||
import Vue from "vue";
|
||||
import febAlive from "feb-alive";
|
||||
import VueRouter from "vue-router";
|
||||
import NProgress from "nprogress";
|
||||
import "nprogress/nprogress.css";
|
||||
// 路由数据
|
||||
import routes from "./routes";
|
||||
import store from '@/store/index';
|
||||
import store from "@/store/index";
|
||||
|
||||
// 在router实例化之前重写history
|
||||
febAlive.resetHistory();
|
||||
@ -43,15 +45,17 @@ Vue.use(febAlive, { router });
|
||||
* 权限验证
|
||||
*/
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
NProgress.start();
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
console.log("before:");
|
||||
console.log(to, from);
|
||||
}
|
||||
store.dispatch("acrou/cancelToken/cancel")
|
||||
store.dispatch("acrou/cancelToken/cancel");
|
||||
next();
|
||||
});
|
||||
|
||||
router.afterEach((to) => {
|
||||
NProgress.done();
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
console.log("after:");
|
||||
console.log(to);
|
||||
|
Loading…
Reference in New Issue
Block a user