This repository has been archived by the owner on Nov 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0fd2017
commit 060a8dd
Showing
11 changed files
with
5,204 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
title: Tabs 选项卡 | ||
date: 2019-06-12 | ||
--- | ||
在一组内容之间快速切换。 | ||
|
||
## 基本用法 | ||
|
||
### 默认展示 | ||
``` | ||
<div className="bg-gray"> | ||
<Tabs | ||
tabs={[ | ||
{ title: '标题1', key: 'key-1', children: <div>第1个tab</div> }, | ||
{ title: '标题2', key: 'key-2', children: <div>第2个tab</div> }, | ||
{ title: '标题3', key: 'key-3', children: <div>第3个tab</div> }, | ||
{ title: '标题4', key: 'key-4', children: <div>第4个tab</div> } | ||
]} | ||
/> | ||
</div> | ||
``` | ||
|
||
### 改变大小 | ||
``` | ||
<div className="bg-gray"> | ||
<Tabs | ||
tabs={[ | ||
{ title: '标题1', key: 'key-1', children: <div>第1个tab</div> }, | ||
{ title: '标题2', key: 'key-2', children: <div>第2个tab</div> }, | ||
{ title: '标题3', key: 'key-3', children: <div>第3个tab</div> }, | ||
{ title: '标题4', key: 'key-4', children: <div>第4个tab</div> } | ||
]} | ||
size="small" | ||
/> | ||
</div> | ||
``` | ||
|
||
### 选项卡靠右 | ||
``` | ||
<div className="bg-gray"> | ||
<Tabs | ||
tabs={[ | ||
{ title: '标题1', key: 'key-1', children: <div>第1个tab</div> }, | ||
{ title: '标题2', key: 'key-2', children: <div>第2个tab</div> }, | ||
{ title: '标题3', key: 'key-3', children: <div>第3个tab</div> }, | ||
{ title: '标题4', key: 'key-4', children: <div>第4个tab</div> } | ||
]} | ||
direction="right" | ||
/> | ||
</div> | ||
``` | ||
|
||
### 监听选项卡切换 | ||
```jsx | ||
() => { | ||
const TABS = [ | ||
{ title: '标题1', key: '1', children: <div>第1个tab</div> }, | ||
{ title: '标题2', key: '2', children: <div>第2个tab</div> }, | ||
{ title: '标题3', key: '3', children: <div>第3个tab</div> }, | ||
{ title: '标题4', key: '4', children: <div>第4个tab</div> }, | ||
]; | ||
const [ key, setKey ] = React.useState(TABS[0].key); | ||
const handleSelect = key => setKey(key); | ||
return ( | ||
<div className="bg-gray"> | ||
<Tabs | ||
tabs={TABS} | ||
activeKey={key} | ||
onSelect={handleSelect} | ||
/> | ||
<p>外部监听当前选中第 {key} 个。</p> | ||
</div> | ||
) | ||
} | ||
``` | ||
|
||
## API | ||
```jsx previewOnly | ||
<PropTable of="tabs" /> | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ date: 2019-06-06 | |
|
||
用来替换默认 `title` 提示,提供解释文案。 | ||
|
||
## 代码演示 | ||
## 基本用法 | ||
### 文本提示 | ||
给文本提供说明文案。 | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.