Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivWeb
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
ReactWeb5
CivWeb
Commits
3cc9cb18
Commit
3cc9cb18
authored
2 years ago
by
曾婧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: hn主题菜单保持只展开一个子菜单
parent
b259eef9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
13 deletions
+18
-13
index.js
src/layouts/AppLayout/components/SlideMenu/index.js
+15
-13
HN.less
src/layouts/HN.less
+3
-0
No files found.
src/layouts/AppLayout/components/SlideMenu/index.js
View file @
3cc9cb18
...
...
@@ -5,6 +5,7 @@ import { ReactSVG } from 'react-svg';
import
useMergedState
from
'rc-util/lib/hooks/useMergedState'
;
import
{
useHistory
}
from
'@wisdom-utils/runtime'
;
import
ProLayout
,
{
getPageTitle
}
from
'@ant-design/pro-layout'
;
import
{
findPathByWidget
}
from
'@wisdom-utils/components/lib/AppLayout/helpers'
;
const
LoadingSkeleton
=
props
=>
{
const
{
route
}
=
props
;
return
(
...
...
@@ -17,9 +18,10 @@ const LoadingSkeleton = props => {
};
const
Menu
=
props
=>
{
const
{
prefixCls
,
collapsed
,
onCollapse
,
onMenuClick
,
menuHeaderRender
,
onMenuHeaderClick
}
=
props
;
const
[
pathname
,
setPathname
]
=
useState
(
''
);
const
{
route
}
=
props
;
const
history
=
useHistory
();
const
[
activeMenu
,
setActiveMenu
]
=
useState
(
"首页"
);
const
[
activeMenu
,
setActiveMenu
]
=
useState
(
'首页'
);
const
[
sunRoute
,
setsunRoute
]
=
useState
(
route
);
const
[
selectIndex
,
setSelectIndex
]
=
useMergedState
(()
=>
-
1
,
{
value
:
props
.
active
,
...
...
@@ -43,7 +45,7 @@ const Menu = props => {
current
=
item
;
childrenRoutes
=
[
item
];
}
setPathname
(
current
.
path
);
setSelectIndex
(
index
);
if
(
/iframe/
.
test
(
current
.
path
))
{
history
.
push
({
...
...
@@ -55,16 +57,13 @@ const Menu = props => {
}
onMenuClick
&&
onMenuClick
(
current
,
childrenRoutes
,
index
);
};
useEffect
(()
=>
{
let
all
=
props
.
flatMenu
;
all
.
forEach
((
it
)
=>
{
if
(
it
.
path
===
props
.
location
.
pathname
){
setActiveMenu
(
it
.
name
)
return
;
}
})
},
[
props
.
location
.
pathname
]);
useEffect
(()
=>
{
var
allWidgets
=
window
.
globalConfig
&&
window
.
globalConfig
.
allWidgets
;
let
homgUrl
=
props
.
config
&&
props
.
config
.
homepage
.
replace
(
/
(
civ_energy
\/)
/g
,
''
);
let
curItem
=
findPathByWidget
(
homgUrl
,
allWidgets
,
''
,
'url'
);
curItem
&&
setActiveMenu
(
curItem
.
label
);
curItem
&&
setPathname
(
curItem
.
path
)
},[])
useEffect
(()
=>
{
if
(
route
&&
route
.
routes
)
{
setsunRoute
(
route
);
...
...
@@ -120,6 +119,9 @@ const Menu = props => {
defaultCollapsed
=
{
false
}
collapsed
=
{
false
}
breakpoint
=
{
'xs'
}
location
=
{{
pathname
,
}}
// onHeaderLogo={handlerIndustry}
// onPageChange={handlerPageChange}
// onMenuPanelItemClick={handleUpdateCurrentIndex}
...
...
@@ -188,7 +190,7 @@ export default props => {
// className={classNames(`${prefixCls}`, `${prefixCls}-fixed`, {
// [`${prefixCls}-collapsed`]: collapsed,
// })}
style
=
{{
paddingTop
:
'50px'
}}
style
=
{{
paddingTop
:
'50px'
}}
>
<
div
className
=
{
`
${
prefixCls
}
-children`
}
>
<
div
className
=
{
`
${
prefixCls
}
-wrapper`
}
style
=
{{
flex
:
'1 1 0%'
,
overflow
:
'hidden auto'
}}
>
...
...
This diff is collapsed.
Click to expand it.
src/layouts/HN.less
View file @
3cc9cb18
...
...
@@ -9,6 +9,9 @@
}
.hnlayout {
:global {
.@{ant-prefix}-menu-dark.@{ant-prefix}-menu-dark:not(.@{ant-prefix}-menu-horizontal) .@{ant-prefix}-menu-item-selected{
background: transparent!important;
}
.@{ant-prefix}-global-page-header-header {
padding-left: 0;
}
...
...
This diff is collapsed.
Click to expand it.
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