feat: Tabs[onNextClick] Tabs[onPrevClick], close: #4395 (#5412)

This commit is contained in:
Benjy Cui 2017-03-21 23:42:16 +08:00 committed by 偏右
parent 45b0693bae
commit d24a647392
4 changed files with 12 additions and 3 deletions

View File

@ -24,6 +24,8 @@ Ant Design has 3 types Tabs for different situation.
| defaultActiveKey | Default actived tabPanel's key, if activeKey is not setted. | - |
| onChange | Callback when tab is switched | Function | - |
| onTabClick | Callback when tab is clicked | Function | - |
| onPrevClick | Callback when prev button is clicked | Function | 无 |
| onNextClick | Callback when next button is clicked | Function | 无 |
| tabBarExtraContent | Extra element in tab bar | React.ReactNode | - |
| tabBarStyle | tar bar style object | object | - |
| type | Basic style of tabs. Options: line, card & editable-card | string | line |

View File

@ -1,5 +1,4 @@
import React from 'react';
import { cloneElement } from 'react';
import React, { cloneElement } from 'react';
import { findDOMNode } from 'react-dom';
import RcTabs, { TabPane } from 'rc-tabs';
import ScrollableInkTabBar from 'rc-tabs/lib/ScrollableInkTabBar';
@ -18,6 +17,8 @@ export interface TabsProps {
hideAdd?: boolean;
onChange?: (activeKey: string) => void;
onTabClick?: Function;
onPrevClick?: (e) => void;
onNextClick?: (e) => void;
tabBarExtraContent?: React.ReactNode | null;
tabBarStyle?: React.CSSProperties;
type?: TabsType;
@ -95,6 +96,8 @@ export default class Tabs extends React.Component<TabsProps, any> {
tabBarStyle,
hideAdd,
onTabClick,
onPrevClick,
onNextClick,
animated,
} = this.props;
warning(
@ -152,6 +155,8 @@ export default class Tabs extends React.Component<TabsProps, any> {
<ScrollableInkTabBar
extraContent={tabBarExtraContent}
onTabClick={onTabClick}
onPrevClick={onPrevClick}
onNextClick={onNextClick}
style={tabBarStyle}
/>
);

View File

@ -27,6 +27,8 @@ Ant Design 依次提供了三级选项卡,分别用于不同的场景。
| defaultActiveKey | 初始化选中面板的 key如果没有设置 activeKey | string | 第一个面板 |
| onChange | 切换面板的回调 | Function | 无 |
| onTabClick | tab 被点击的回调 | Function | 无 |
| onPrevClick | prev 按钮被点击的回调 | Function | 无 |
| onNextClick | next 按钮被点击的回调 | Function | 无 |
| tabBarExtraContent | tab bar 上额外的元素 | React.ReactNode | 无 |
| tabBarStyle | tar bar 的样式对象 | object | - |
| type | 页签的基本样式,可选 `line`、`card` `editable-card` 类型 | string | 'line' |

View File

@ -63,7 +63,7 @@
"rc-steps": "~2.4.0",
"rc-switch": "~1.4.2",
"rc-table": "~5.2.13",
"rc-tabs": "~7.2.0",
"rc-tabs": "~7.3.0",
"rc-time-picker": "~2.2.1",
"rc-tooltip": "~3.4.2",
"rc-tree": "~1.4.0",