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
P
pro-blocks
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
pro-blocks
Commits
a8caa500
Commit
a8caa500
authored
Dec 26, 2017
by
afc163
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add activeTabKey for PageHeader
parent
577ded4b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
2 deletions
+12
-2
src/components/PageHeader/demo/standard.md
src/components/PageHeader/demo/standard.md
+1
-0
src/components/PageHeader/demo/structure.md
src/components/PageHeader/demo/structure.md
+1
-0
src/components/PageHeader/index.d.ts
src/components/PageHeader/index.d.ts
+1
-0
src/components/PageHeader/index.js
src/components/PageHeader/index.js
+6
-1
src/components/PageHeader/index.md
src/components/PageHeader/index.md
+1
-0
src/routes/List/List.js
src/routes/List/List.js
+2
-1
No files found.
src/components/PageHeader/demo/standard.md
View file @
a8caa500
...
@@ -88,6 +88,7 @@ ReactDOM.render(
...
@@ -88,6 +88,7 @@ ReactDOM.render(
extraContent
=
{
extra
}
extraContent
=
{
extra
}
breadcrumbList
=
{
breadcrumbList
}
breadcrumbList
=
{
breadcrumbList
}
tabList
=
{
tabList
}
tabList
=
{
tabList
}
tabActiveKey
=
"detail"
onTabChange
=
{
onTabChange
}
onTabChange
=
{
onTabChange
}
/>
/>
</
div
>
</
div
>
...
...
src/components/PageHeader/demo/structure.md
View file @
a8caa500
...
@@ -34,6 +34,7 @@ ReactDOM.render(
...
@@ -34,6 +34,7 @@ ReactDOM.render(
extraContent
=
{
<
div
className
=
"extraContent"
>
extraContent
</
div
>
}
extraContent
=
{
<
div
className
=
"extraContent"
>
extraContent
</
div
>
}
breadcrumbList
=
{
breadcrumbList
}
breadcrumbList
=
{
breadcrumbList
}
tabList
=
{
tabList
}
tabList
=
{
tabList
}
tabActiveKey
=
"1"
/>
/>
</
div
>
</
div
>
,
mountNode
);
,
mountNode
);
...
...
src/components/PageHeader/index.d.ts
View file @
a8caa500
...
@@ -9,6 +9,7 @@ export interface PageHeaderProps {
...
@@ -9,6 +9,7 @@ export interface PageHeaderProps {
params
?:
any
;
params
?:
any
;
breadcrumbList
?:
Array
<
{
title
:
React
.
ReactNode
;
href
?:
string
}
>
;
breadcrumbList
?:
Array
<
{
title
:
React
.
ReactNode
;
href
?:
string
}
>
;
tabList
?:
Array
<
{
key
:
string
;
tab
:
React
.
ReactNode
}
>
;
tabList
?:
Array
<
{
key
:
string
;
tab
:
React
.
ReactNode
}
>
;
tabActiveKey
?:
string
;
onTabChange
?:
(
key
:
string
)
=>
void
;
onTabChange
?:
(
key
:
string
)
=>
void
;
linkElement
?:
React
.
ReactNode
;
linkElement
?:
React
.
ReactNode
;
}
}
...
...
src/components/PageHeader/index.js
View file @
a8caa500
...
@@ -60,6 +60,7 @@ export default class PageHeader extends PureComponent {
...
@@ -60,6 +60,7 @@ export default class PageHeader extends PureComponent {
const
{
const
{
title
,
logo
,
action
,
content
,
extraContent
,
title
,
logo
,
action
,
content
,
extraContent
,
breadcrumbList
,
tabList
,
className
,
linkElement
=
'
a
'
,
breadcrumbList
,
tabList
,
className
,
linkElement
=
'
a
'
,
activeTabKey
,
}
=
this
.
props
;
}
=
this
.
props
;
const
clsString
=
classNames
(
styles
.
pageHeader
,
className
);
const
clsString
=
classNames
(
styles
.
pageHeader
,
className
);
let
breadcrumb
;
let
breadcrumb
;
...
@@ -120,7 +121,10 @@ export default class PageHeader extends PureComponent {
...
@@ -120,7 +121,10 @@ export default class PageHeader extends PureComponent {
breadcrumb
=
null
;
breadcrumb
=
null
;
}
}
const
tabDefaultValue
=
tabList
&&
(
tabList
.
filter
(
item
=>
item
.
default
)[
0
]
||
tabList
[
0
]);
let
tabDefaultValue
;
if
(
activeTabKey
!==
undefined
&&
tabList
)
{
tabDefaultValue
=
tabList
.
filter
(
item
=>
item
.
default
)[
0
]
||
tabList
[
0
];
}
return
(
return
(
<
div
className
=
{
clsString
}
>
<
div
className
=
{
clsString
}
>
...
@@ -144,6 +148,7 @@ export default class PageHeader extends PureComponent {
...
@@ -144,6 +148,7 @@ export default class PageHeader extends PureComponent {
<
Tabs
<
Tabs
className
=
{
styles
.
tabs
}
className
=
{
styles
.
tabs
}
defaultActiveKey
=
{(
tabDefaultValue
&&
tabDefaultValue
.
key
)}
defaultActiveKey
=
{(
tabDefaultValue
&&
tabDefaultValue
.
key
)}
activeKey
=
{
activeTabKey
}
onChange
=
{
this
.
onChange
}
onChange
=
{
this
.
onChange
}
>
>
{
{
...
...
src/components/PageHeader/index.md
View file @
a8caa500
...
@@ -22,6 +22,7 @@ order: 11
...
@@ -22,6 +22,7 @@ order: 11
| params | 面包屑相关属性,路由的参数 | object | - |
| params | 面包屑相关属性,路由的参数 | object | - |
| breadcrumbList | 面包屑数据,配置了
`routes`
`params`
时此属性无效 | array
<
{
title:
ReactNode
,
href
?
:
string
}
>
| - |
| breadcrumbList | 面包屑数据,配置了
`routes`
`params`
时此属性无效 | array
<
{
title:
ReactNode
,
href
?
:
string
}
>
| - |
| tabList | tab 标题列表 | array
<
{
key:
string
,
tab:
ReactNode
}
>
| - |
| tabList | tab 标题列表 | array
<
{
key:
string
,
tab:
ReactNode
}
>
| - |
| tabActiveKey | 当前高亮的 tab 项 | string | - |
| onTabChange | 切换面板的回调 | (key) => void | - |
| onTabChange | 切换面板的回调 | (key) => void | - |
| linkElement | 定义链接的元素,默认为
`a`
,可传入 react-router 的 Link | string
\|
ReactElement | - |
| linkElement | 定义链接的元素,默认为
`a`
,可传入 react-router 的 Link | string
\|
ReactElement | - |
...
...
src/routes/List/List.js
View file @
a8caa500
...
@@ -48,7 +48,7 @@ export default class SearchList extends Component {
...
@@ -48,7 +48,7 @@ export default class SearchList extends Component {
<
/div
>
<
/div
>
);
);
const
{
match
,
routerData
}
=
this
.
props
;
const
{
match
,
routerData
,
location
}
=
this
.
props
;
const
routes
=
getRoutes
(
match
.
path
,
routerData
);
const
routes
=
getRoutes
(
match
.
path
,
routerData
);
return
(
return
(
...
@@ -56,6 +56,7 @@ export default class SearchList extends Component {
...
@@ -56,6 +56,7 @@ export default class SearchList extends Component {
title
=
"
搜索列表
"
title
=
"
搜索列表
"
content
=
{
mainSearch
}
content
=
{
mainSearch
}
tabList
=
{
tabList
}
tabList
=
{
tabList
}
activeTabKey
=
{
location
.
pathname
.
replace
(
`
${
match
.
path
}
/`
,
''
)}
onTabChange
=
{
this
.
handleTabChange
}
onTabChange
=
{
this
.
handleTabChange
}
>
>
<
Switch
>
<
Switch
>
...
...
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