lrf 2 years ago
parent
commit
87bac4fd1b
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/router/guard.js

+ 3 - 2
src/router/guard.js

@@ -38,8 +38,9 @@ export default (router) => {
     else {
       const keys = Object.keys(menu).filter((f) => f !== 'mode');
       let toPath = '';
-      if (keys.includes('/')) toPath = '/';
-      else toPath = _.head(keys);
+      const r = keys.find((f) => to.path.includes(f));
+      if (r) toPath = '/';
+      else toPath = from.path;
       next(toPath);
       Message.error('您无权限访问该页面');
     }