Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
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
黄庭坚
jinfa-platform
Commits
528265d9
Commit
528265d9
authored
May 24, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加 onBack 自定义返回事件
parent
13aa9fff
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
10 deletions
+20
-10
index.tsx
src/layouts/AnchorPage/index.tsx
+10
-1
index.tsx
src/pages/member/memberMaintain/detailed/index.tsx
+10
-9
No files found.
src/layouts/AnchorPage/index.tsx
View file @
528265d9
...
...
@@ -40,6 +40,10 @@ interface IProps {
* 自定义样式
*/
customStyle
?:
React
.
CSSProperties
,
/**
* 自定义返回事件
*/
onBack
?:
()
=>
void
,
children
?:
React
.
ReactNode
,
}
...
...
@@ -50,6 +54,7 @@ const AnchorPage: React.FC<IProps> = (props: IProps) => {
extra
,
anchors
,
customStyle
,
onBack
,
children
,
}
=
props
;
const
firstKey
=
anchors
.
length
?
`#
${
anchors
[
0
].
key
}
`
:
''
;
...
...
@@ -57,6 +62,10 @@ const AnchorPage: React.FC<IProps> = (props: IProps) => {
const
[
rect
,
measuredRef
]
=
useClientRect
();
const
handleBack
=
()
=>
{
if
(
onBack
)
{
onBack
();
return
;
}
history
.
goBack
();
};
...
...
@@ -81,7 +90,6 @@ const AnchorPage: React.FC<IProps> = (props: IProps) => {
>
<
div
className=
{
styles
[
'anchor-page-header'
]
}
style=
{
customStyle
}
ref=
{
measuredRef
}
>
<
Anchor
...
...
@@ -132,6 +140,7 @@ const AnchorPage: React.FC<IProps> = (props: IProps) => {
AnchorPage
.
defaultProps
=
{
extra
:
null
,
customStyle
:
{},
onBack
:
undefined
,
children
:
null
,
};
...
...
src/pages/member/memberMaintain/detailed/index.tsx
View file @
528265d9
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-01-06 11:36:35
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-2
0 13:54:45
* @LastEditTime: 2021-05-2
4 10:12:09
* @Description:
*/
import
React
,
{
useState
,
useEffect
}
from
'react'
;
...
...
@@ -74,7 +74,7 @@ const MemberMaintainDetailed: React.FC<QueryProps> = props => {
getBasicInfo
();
},
[]);
const
handle
Tab
Change
=
(
val
:
string
)
=>
{
const
handle
Bookmark
Change
=
(
val
:
string
)
=>
{
const
{
match
}
=
props
;
const
url
=
match
.
url
===
'/'
?
''
:
match
.
url
;
switch
(
val
)
{
...
...
@@ -95,20 +95,20 @@ const MemberMaintainDetailed: React.FC<QueryProps> = props => {
}
};
const
get
Tab
Key
=
()
=>
{
const
get
Bookmark
Key
=
()
=>
{
const
{
match
,
location
}
=
props
;
const
url
=
match
.
path
===
'/'
?
''
:
match
.
path
;
const
tab
Key
=
location
.
pathname
.
replace
(
`
${
url
}
/`
,
''
);
if
(
tabKey
&&
tab
Key
!==
'/'
)
{
return
tab
Key
;
const
mark
Key
=
location
.
pathname
.
replace
(
`
${
url
}
/`
,
''
);
if
(
markKey
&&
mark
Key
!==
'/'
)
{
return
mark
Key
;
}
return
'basicInfo'
;
};
const
getAnchorsArr
=
()
=>
{
const
tabKey
=
getTab
Key
();
const
markKey
=
getBookmark
Key
();
let
ret
=
[];
switch
(
tab
Key
)
{
switch
(
mark
Key
)
{
case
'basicInfo'
:
ret
=
[
{
...
...
@@ -209,9 +209,10 @@ const MemberMaintainDetailed: React.FC<QueryProps> = props => {
)
}
/>
)
}
onBack=
{
()
=>
history
.
push
(
`/memberCenter/memberAbility/manage/maintain`
)
}
anchors=
{
getAnchorsArr
()
}
extra=
{
(
<
Bookmark
value=
{
get
TabKey
()
}
onChange=
{
handleTab
Change
}
>
<
Bookmark
value=
{
get
BookmarkKey
()
}
onChange=
{
handleBookmark
Change
}
>
<
Bookmark
.
Item
value=
"basicInfo"
title=
"基本信息"
icon=
{
<
UnorderedListOutlined
/>
}
/>
<
Bookmark
.
Item
value=
"2"
title=
"档案信息"
icon=
{
<
FolderOutlined
/>
}
/>
<
Bookmark
.
Item
value=
"levelInfo"
title=
"等级信息"
icon=
{
<
BarChartOutlined
/>
}
/>
...
...
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