@@ -27,25 +27,34 @@ export const readedMessages = state => state.readedMessages
2727
2828export const unreadMessages = state => state . unreadMessages
2929
30+ /**
31+ * 在侧边栏展示时,如果当前路由 children 属性为空,则删除该路由
32+ * @param {* } arr 路由配置项数据
33+ */
3034function IterationDelateMenuChildren ( arr ) {
3135 if ( arr . length ) {
3236 for ( const i in arr ) {
3337 if ( arr [ i ] . children && ! arr [ i ] . children . length ) {
34- delete arr [ i ] // eslint-disable-line
35- } else if ( arr [ i ] . children && ! arr [ i ] . children . length ) {
38+ delete arr [ i ]
39+ } else if ( arr [ i ] . children && arr [ i ] . children . length ) {
3640 IterationDelateMenuChildren ( arr [ i ] . children )
3741 }
3842 }
3943 }
4044 return arr
4145}
4246
47+ /**
48+ * Shaking 掉无限制路由
49+ * @param {array } stageConfig 路由配置项数据
50+ * @param {array } permissions 当前登录管理员所拥有的权限集合
51+ * @param {object } currentUser 当前登录管理员
52+ */
4353function permissionShaking ( stageConfig , permissions , currentUser ) {
44- // eslint-disable-line
4554 const shookConfig = stageConfig . filter ( route => {
4655 if ( Util . hasPermission ( permissions , route , currentUser ) ) {
4756 if ( route . children && route . children . length ) {
48- route . children = permissionShaking ( route . children , permissions , currentUser ) // eslint-disable-line
57+ route . children = permissionShaking ( route . children , permissions , currentUser )
4958 }
5059 return true
5160 }
@@ -176,7 +185,7 @@ export const getStageInfo = state => {
176185 return result
177186 }
178187
179- if ( stages . children ) {
188+ if ( stages . children && stages . children . length ) {
180189 result = findStage ( stages . children , name )
181190 if ( result ) {
182191 result . unshift ( stages )
0 commit comments