mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-16 01:29:11 +08:00
628968f460
* refactor: Using items * docs: replace with items * docs: deprecated demo * test: Update snapshot * docs: simple basic demo * test: coverage
50 lines
701 B
Markdown
50 lines
701 B
Markdown
---
|
|
order: 0
|
|
title:
|
|
zh-CN: 基本
|
|
en-US: Basic
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
默认选中第一项。
|
|
|
|
## en-US
|
|
|
|
Default activate first tab.
|
|
|
|
```tsx
|
|
import { Tabs } from 'antd';
|
|
import React from 'react';
|
|
|
|
const onChange = (key: string) => {
|
|
console.log(key);
|
|
};
|
|
|
|
const App: React.FC = () => (
|
|
<Tabs
|
|
defaultActiveKey="1"
|
|
onChange={onChange}
|
|
items={[
|
|
{
|
|
label: `Tab 1`,
|
|
key: '1',
|
|
children: `Content of Tab Pane 1`,
|
|
},
|
|
{
|
|
label: `Tab 2`,
|
|
key: '2',
|
|
children: `Content of Tab Pane 2`,
|
|
},
|
|
{
|
|
label: `Tab 3`,
|
|
key: '3',
|
|
children: `Content of Tab Pane 3`,
|
|
},
|
|
]}
|
|
/>
|
|
);
|
|
|
|
export default App;
|
|
```
|