Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
Overview
Overview
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
baiguangyao
mr-julyedu
Commits
fc8197b4
Commit
fc8197b4
authored
Aug 22, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nav icon
parent
14f6bd88
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
src/common/NavBar/index.js
+9
-5
No files found.
src/common/NavBar/index.js
View file @
fc8197b4
import
React
from
'react'
;
import
{
NavLink
}
from
'react-router-dom'
import
{
NavLink
,
withRouter
}
from
'react-router-dom'
import
'./index.scss'
;
const
navLinkConfig
=
[
...
...
@@ -7,29 +7,33 @@ const navLinkConfig = [
to
:
'/'
,
exact
:
true
,
icon
:
'iconshouye-xianxing'
,
activeIcon
:
'iconshouye1'
,
text
:
'首页'
},
{
to
:
'/classify'
,
exact
:
false
,
icon
:
'iconfenlei-xianxing'
,
activeIcon
:
'iconfenlei-chunse'
,
text
:
'分类'
},
{
to
:
'/study'
,
exact
:
false
,
icon
:
'iconxuexi-xianxing'
,
activeIcon
:
'iconxuexi-chunse'
,
text
:
'学习'
},
{
to
:
'/my'
,
exact
:
false
,
icon
:
'iconwode-xianxing'
,
activeIcon
:
'iconwode-chunse'
,
text
:
'我的'
}
]
const
NavBar
=
React
.
memo
(()
=>
{
const
NavBar
=
React
.
memo
((
{
location
}
)
=>
{
return
(
<
div
className
=
"nav-bar"
>
{
...
...
@@ -42,7 +46,7 @@ const NavBar = React.memo(() => {
key
=
{
icon
}
{...
rest
}
>
<
i
className
=
{
`iconfont
${
icon
}
`
}
/
>
<
i
className
=
{
`iconfont
${
location
.
pathname
.
startsWith
(
item
.
to
)
?
item
.
activeIcon
:
item
.
icon
}
`
}
/
>
<
span
>
{
text
}
<
/span
>
<
/NavLink
>
)
...
...
@@ -52,4 +56,4 @@ const NavBar = React.memo(() => {
)
})
export
default
NavBar
\ No newline at end of file
export
default
withRouter
(
NavBar
)
\ No newline at end of file
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