Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-admin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linweijiong
jinfa-admin
Commits
05fdedbc
Commit
05fdedbc
authored
Jun 16, 2022
by
钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 处理线上菜单无法显示问题
parent
7656f9bf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
10 deletions
+9
-10
index.ts
config/routes/index.ts
+1
-1
MenuSlider.tsx
src/layouts/components/MenuSlider.tsx
+2
-2
OuterSide.tsx
src/layouts/components/OuterSide.tsx
+6
-7
No files found.
config/routes/index.ts
View file @
05fdedbc
...
...
@@ -74,4 +74,4 @@ const mountRouter = [
const
router
=
isDev
?
localRouter
:
mountRouter
export
{
router
,
isDev
};
export
{
router
,
isDev
};
src/layouts/components/MenuSlider.tsx
View file @
05fdedbc
...
...
@@ -10,7 +10,8 @@ import {
import
OuterSider
from
'./OuterSide'
import
styles
from
'../styles/MenuSlider.less'
import
{
getRouters
}
from
'@/utils/auth'
;
import
{
isDev
}
from
'@/constants'
;
// import { isDev } from '@/constants';
import
{
isDev
}
from
'../../../config/routes'
import
menuIcon
from
'../../asserts/menuIcon/logo.png'
const
{
Sider
}
=
Layout
const
{
SubMenu
}
=
Menu
;
...
...
@@ -29,7 +30,6 @@ const MenuSlider: React.FC<MenuSliderProps> = (props) => {
const
{
menuData
,
pathname
,
currentSelectKey
=
[],
openKeys
=
[],
changeOpenKeys
}
=
props
const
[
innerCollapsed
,
setInnerCollapsed
]
=
useState
(
false
)
let
menuItemsCache
=
null
const
getMenuRouter
=
(
routes
:
any
,
pathname
:
any
)
=>
{
const
list
=
routes
.
filter
((
item
:
any
)
=>
pathname
.
indexOf
(
item
.
key
)
>
-
1
)
return
list
[
0
]
...
...
src/layouts/components/OuterSide.tsx
View file @
05fdedbc
...
...
@@ -3,7 +3,8 @@ import { Layout, Menu, Avatar, Image } from 'antd'
import
{
Link
}
from
'umi'
import
styles
from
'../styles/MenuSlider.less'
import
{
getRouters
}
from
'@/utils/auth'
import
{
isDev
}
from
'@/constants'
// import { isDev } from '@/constants'
import
{
isDev
}
from
'../../../config/routes'
import
{
observer
,
inject
}
from
'mobx-react'
;
import
CustomIcon
from
'./CustomIcon'
;
import
Icon
from
'@ant-design/icons'
;
...
...
@@ -22,13 +23,12 @@ const OuterSider: React.FC<OuterSiderProps> = observer((props) => {
const
{
menuData
,
pathname
=
"/"
,
currentRouter
}
=
props
const
authRouters
=
getRouters
()
let
defaultSelectedKeys
=
""
const
isAuthPath
=
(
path
)
=>
{
if
(
isDev
)
{
//
if (isDev) {
return
true
}
else
{
return
authRouters
.
includes
(
path
)
}
//
} else {
//
return authRouters.includes(path)
//
}
}
const
getSubMenu
=
()
=>
{
...
...
@@ -40,7 +40,6 @@ const OuterSider: React.FC<OuterSiderProps> = observer((props) => {
if
(
code
&&
code
===
item
.
relationParentCode
)
{
defaultSelectedKeys
=
item
.
relationParentCode
}
!
item
.
hideInMenu
&&
isAuthPath
(
item
.
path
)
&&
subHeadMenus
.
push
({
path
:
item
.
path
,
title
:
item
.
name
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment