Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
e618d4d1
Commit
e618d4d1
authored
Mar 09, 2018
by
ddcat1115
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PageHeader support tabDefaultActiveKey
parent
d44f8af4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
8 deletions
+7
-8
src/components/PageHeader/index.d.ts
src/components/PageHeader/index.d.ts
+1
-0
src/components/PageHeader/index.js
src/components/PageHeader/index.js
+5
-8
src/components/PageHeader/index.md
src/components/PageHeader/index.md
+1
-0
No files found.
src/components/PageHeader/index.d.ts
View file @
e618d4d1
...
...
@@ -10,6 +10,7 @@ export interface IPageHeaderProps {
breadcrumbList
?:
Array
<
{
title
:
React
.
ReactNode
;
href
?:
string
}
>
;
tabList
?:
Array
<
{
key
:
string
;
tab
:
React
.
ReactNode
}
>
;
tabActiveKey
?:
string
;
tabDefaultActiveKey
?:
string
;
onTabChange
?:
(
key
:
string
)
=>
void
;
tabBarExtraContent
?:
React
.
ReactNode
;
linkElement
?:
React
.
ReactNode
;
...
...
src/components/PageHeader/index.js
View file @
e618d4d1
...
...
@@ -166,18 +166,15 @@ export default class PageHeader extends PureComponent {
tabList
,
className
,
tabActiveKey
,
tabDefaultActiveKey
,
tabBarExtraContent
,
}
=
this
.
props
;
const
clsString
=
classNames
(
styles
.
pageHeader
,
className
);
let
tabDefaultValue
;
if
(
tabActiveKey
===
undefined
&&
tabList
)
{
tabDefaultValue
=
tabList
.
filter
(
item
=>
item
.
default
)[
0
]
||
tabList
[
0
];
}
const
breadcrumb
=
this
.
conversionBreadcrumbList
();
const
activeKeyProps
=
{
defaultActiveKey
:
tabDefaultValue
&&
tabDefaultValue
.
key
,
};
const
activeKeyProps
=
{};
if
(
tabDefaultActiveKey
!==
undefined
)
{
activeKeyProps
.
defaultActiveKey
=
tabDefaultActiveKey
;
}
if
(
tabActiveKey
!==
undefined
)
{
activeKeyProps
.
activeKey
=
tabActiveKey
;
}
...
...
src/components/PageHeader/index.md
View file @
e618d4d1
...
...
@@ -25,6 +25,7 @@ order: 11
| breadcrumbNameMap | 面包屑相关属性,路由的地址-名称映射表 | object | - |
| tabList | tab 标题列表 | array
<
{
key:
string
,
tab:
ReactNode
}
>
| - |
| tabActiveKey | 当前高亮的 tab 项 | string | - |
| tabDefaultActiveKey | 默认高亮的 tab 项 | string | 第一项 |
| onTabChange | 切换面板的回调 | (key) => void | - |
| linkElement | 定义链接的元素,默认为
`a`
,可传入 react-router 的 Link | string
\|
ReactElement | - |
...
...
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