import NProgress from "nprogress"; import "nprogress/nprogress.css"; import store from "@/store/index"; import getPageTitle from "@/utils/get-page-title"; // 路由页面路由首位配置 export default (VueRouter, router) => { // 解决路由点击重复报错 const VueRouterPush = VueRouter.prototype.push; VueRouter.prototype.push = function push(to) { return VueRouterPush.call(this, to).catch((err) => err); }; VueRouter.prototype.replace = function push(to) { return VueRouterPush.call(this, to).catch((err) => err); }; // 页面路由切换时进度条 // let router = new VueRouter(); router.beforeEach((to, from, next) => { console.log(store); NProgress.start(); document.title = getPageTitle(to.fullPath); next(); }); router.afterEach(() => { NProgress.done(); }); };