Browse Source

修改导航菜单有缓存导致菜单显示不正确的问题

niuheng 3 years ago
parent
commit
60390e9901
2 changed files with 5 additions and 4 deletions
  1. 1 1
      src/framework/layout/PageSidebar.vue
  2. 4 3
      src/utils/scan/tools.js

+ 1 - 1
src/framework/layout/PageSidebar.vue

@@ -88,7 +88,7 @@ export default {
     },
     created() {
         // console.log('--------------------- PageSidebar created')
-        // console.log('*****************menus ', JSON.parse(JSON.stringify(this.menus)))
+        // console.log('***********************************menus ', JSON.parse(JSON.stringify(this.menus)))
     },
 
     mounted() {},

+ 4 - 3
src/utils/scan/tools.js

@@ -692,13 +692,14 @@ tools.formatMenu = (originaMenuList) => {
   var newMenuList = [];
   var tempNewMenuList = [];
   var menuNameList = [];
+  var _localMenusList = JSON.parse(JSON.stringify(localMenusList));
   (originaMenuList || []).forEach(originaMenu => {
-    for (var i = 0; i < localMenusList.length; i++) {
-      var localMenu = localMenusList[i];
+    for (var i = 0; i < _localMenusList.length; i++) {
+      var localMenu = _localMenusList[i];
       if (localMenu.name == originaMenu.authorizationName) {
         //---------------------------------------------加上一级菜单
         if (menuNameList.indexOf(originaMenu.productName) == -1) {
-          var firstLocalMenu = localMenusList.filter(_c => {
+          var firstLocalMenu = _localMenusList.filter(_c => {
             return _c.name == originaMenu.productName;
           })[0];
           if (firstLocalMenu) {