|
|
被表白的饺子 · python回车换行和回车结束的字符串_Py ...· 2 年前 · |
|
|
文质彬彬的黑框眼镜 · czhko的个人空间-czhko个人主页-哔 ...· 3 年前 · |
|
|
爱旅游的打火机 · MFC分组Radio ...· 3 年前 · |
|
|
狂野的投影仪 · Oops!!! - 简书· 3 年前 · |
|
|
逃跑的棒棒糖 · python - How to tell ...· 3 年前 · |
选项卡切换组件。
提供平级的区域将大块内容进行收纳和展现,保持界面整洁。
Ant Design 依次提供了三级选项卡,分别用于不同的场景。
默认选中第一项。
禁用某一项。
标签居中展示。
有图标的标签。
可以左右、上下滑动,容纳更多标签。
可以在页签两边添加附加操作。
大号页签用在页头区域,小号用在弹出框等较狭窄的容器内。
有四个位置,
tabPosition="left|right|top|bottom"
。在移动端下,
left|right
会自动切换成
top
。
另一种样式的页签,不提供对应的垂直样式。
只有卡片样式的页签支持新增和关闭选项。使用
closable={false}
禁止关闭。
隐藏默认的页签增加图标,给自定义触发器绑定事件。
使用
react-sticky-box
和
renderTabBar
实现吸顶效果。
使用 dnd-kit 实现标签可拖拽。
通用属性参考: 通用属性
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|---|---|---|---|---|
| activeKey | 当前激活 tab 面板的 key | string | - | |
| addIcon | 自定义添加按钮 | ReactNode | - | 4.4.0 |
| animated | 是否使用动画切换 Tabs | boolean| { inkBar: boolean, tabPane: boolean } | { inkBar: true, tabPane: false } | |
| centered | 标签居中展示 | boolean | false | 4.4.0 |
| defaultActiveKey | 初始化选中面板的 key,如果没有设置 activeKey | string |
第一个面板
|
|
| hideAdd |
是否隐藏加号图标,在
type="editable-card"
时有效
|
boolean | false | |
| items | 配置选项卡内容 | TabItemType | [] | 4.23.0 |
| moreIcon | 自定义折叠 icon | ReactNode | <EllipsisOutlined /> | 4.14.0 |
| popupClassName |
更多菜单的
className
|
string | - | 4.21.0 |
| renderTabBar | 替换 TabBar,用于二次封装标签头 | (props: DefaultTabBarProps, DefaultTabBar: React.ComponentClass) => React.ReactElement | - | |
| size |
大小,提供
large
middle
和
small
三种大小
|
string |
middle
|
|
| tabBarExtraContent | tab bar 上额外的元素 | ReactNode | {left?: ReactNode, right?: ReactNode} | - | object: 4.6.0 |
| tabBarGutter | tabs 之间的间隙 | number | - | |
| tabBarStyle | tab bar 的样式对象 | CSSProperties | - | |
| tabPosition |
页签位置,可选值有
top
right
bottom
left
|
string |
top
|
|
| destroyInactiveTabPane | 被隐藏时是否销毁 DOM 结构 | boolean | false | |
| type |
页签的基本样式,可选
line
、
card
editable-card
类型
|
string |
line
|
|
| onChange | 切换面板的回调 | function(activeKey) {} | - | |
| onEdit |
新增和删除页签的回调,在
type="editable-card"
时有效
|
(action === 'add' ? event : targetKey, action): void | - | |
| onTabClick | tab 被点击的回调 | function(key: string, event: MouseEvent) | - | |
| onTabScroll | tab 滚动时触发 |
function({ direction:
left
|
right
|
top
|
bottom
})
|
- | 4.3.0 |
更多属性查看 rc-tabs tabs
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| closeIcon |
自定义关闭图标,在
type="editable-card"
时有效。5.7.0:设置为
null
或
false
时隐藏关闭按钮
|
boolean | ReactNode | - |
| disabled | 禁用某一项 | boolean | false |
| forceRender | 被隐藏时是否渲染 DOM 结构 | boolean | false |
| key | 对应 activeKey | string | - |
| label | 选项卡头显示文字 | ReactNode | - |
| children | 选项卡头显示内容 | ReactNode | - |
|
|
狂野的投影仪 · Oops!!! - 简书 3 年前 |