|
@@ -1,5 +1,5 @@
|
|
|
import { createRouter, createWebHashHistory } from "vue-router";
|
|
import { createRouter, createWebHashHistory } from "vue-router";
|
|
|
-import { ElNotification, ElMessageBox } from "element-plus";
|
|
|
|
|
|
|
+import { ElMessageBox } from "element-plus";//ElNotification,
|
|
|
import config from "@/config";
|
|
import config from "@/config";
|
|
|
import NProgress from "nprogress";
|
|
import NProgress from "nprogress";
|
|
|
import "nprogress/nprogress.css";
|
|
import "nprogress/nprogress.css";
|
|
@@ -170,14 +170,24 @@ router.afterEach((to, from) => {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
router.onError((error) => {
|
|
router.onError((error) => {
|
|
|
- console.log('routerError:message', error.message)
|
|
|
|
|
- console.log('routerError:targetPath', router.history.pending.fullPath)
|
|
|
|
|
|
|
+ ElMessageBox.confirm(`routerError:message: ${error.message}`, 'Warning', {
|
|
|
|
|
+ confirmButtonText: 'OK',
|
|
|
|
|
+ cancelButtonText: 'Cancel',
|
|
|
|
|
+ type: 'warning',
|
|
|
|
|
+ center: true,
|
|
|
|
|
+ })
|
|
|
|
|
+ ElMessageBox.confirm(`routerError:targetPath: ${router.history.pending.fullPath}`, 'Warning', {
|
|
|
|
|
+ confirmButtonText: 'OK',
|
|
|
|
|
+ cancelButtonText: 'Cancel',
|
|
|
|
|
+ type: 'warning',
|
|
|
|
|
+ center: true,
|
|
|
|
|
+ })
|
|
|
NProgress.done();
|
|
NProgress.done();
|
|
|
- const pattern = /Loading chunk (\d)+ failed/g;
|
|
|
|
|
- const isChunkLoadFailed = error.message.match(pattern);
|
|
|
|
|
- const targetPath = router.history.pending.fullPath;
|
|
|
|
|
- if (isChunkLoadFailed) router.replace(targetPath);
|
|
|
|
|
- else ElNotification.error({ title: "路由错误", message: error.message });
|
|
|
|
|
|
|
+ // const pattern = /Loading chunk (\d)+ failed/g;
|
|
|
|
|
+ // const isChunkLoadFailed = error.message.match(pattern);
|
|
|
|
|
+ // const targetPath = router.history.pending.fullPath;
|
|
|
|
|
+ // if (isChunkLoadFailed) router.replace(targetPath);
|
|
|
|
|
+ // else ElNotification.error({ title: "路由错误", message: error.message });
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// 生成路由对象
|
|
// 生成路由对象
|