From 5ec6f73d6f8a55ff7e8355548c97253c55e8b7ba Mon Sep 17 00:00:00 2001 From: iczer <1126263215@qq.com> Date: Tue, 1 Sep 2020 19:59:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20problem=20tha=20the=20authority=20config?= =?UTF-8?q?=20of=20route=20be=20overwritten;=20:bug:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=EF=BC=9A=E8=B7=AF=E7=94=B1=E6=9D=83=E9=99=90=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E8=A2=AB=E8=A6=86=E7=9B=96=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/authority-utils.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/utils/authority-utils.js b/src/utils/authority-utils.js index 71ab473..e421e12 100644 --- a/src/utils/authority-utils.js +++ b/src/utils/authority-utils.js @@ -55,9 +55,11 @@ function hasAnyRole(required, roles) { */ function filterMenu(menuData, permissions, roles) { menuData.forEach(menu => { - menu.meta.invisible = !hasPermission(menu, permissions) && !hasRole(menu, roles) - if (menu.children && menu.children.length > 0) { - filterMenu(menu.children, permissions, roles) + if (menu.meta && menu.meta.invisible === undefined) { + menu.meta.invisible = !hasPermission(menu, permissions) && !hasRole(menu, roles) + if (menu.children && menu.children.length > 0) { + filterMenu(menu.children, permissions, roles) + } } }) }