mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
demo: update demo code (#39982)
* type: add Tab type * add notes * update demo code
This commit is contained in:
parent
a63789e3dc
commit
977f4da9df
@ -1,2 +1,3 @@
|
||||
// must be .js file, can't modify to be .ts file!
|
||||
// eslint-disable-next-line no-restricted-exports
|
||||
export { default } from './theme/common/Loading';
|
||||
|
@ -1,32 +1,29 @@
|
||||
import React from 'react';
|
||||
import { Tabs } from 'antd';
|
||||
import type { TabsProps } from 'antd';
|
||||
|
||||
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`,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
const items: TabsProps['items'] = [
|
||||
{
|
||||
key: '1',
|
||||
label: `Tab 1`,
|
||||
children: `Content of Tab Pane 1`,
|
||||
},
|
||||
{
|
||||
key: '2',
|
||||
label: `Tab 2`,
|
||||
children: `Content of Tab Pane 2`,
|
||||
},
|
||||
{
|
||||
key: '3',
|
||||
label: `Tab 3`,
|
||||
children: `Content of Tab Pane 3`,
|
||||
},
|
||||
];
|
||||
|
||||
const App: React.FC = () => <Tabs defaultActiveKey="1" items={items} onChange={onChange} />;
|
||||
|
||||
export default App;
|
||||
|
@ -6,7 +6,6 @@ import type { TabsProps as RcTabsProps } from 'rc-tabs';
|
||||
import RcTabs from 'rc-tabs';
|
||||
import type { EditableConfig } from 'rc-tabs/lib/interface';
|
||||
import * as React from 'react';
|
||||
|
||||
import { ConfigContext } from '../config-provider';
|
||||
import type { SizeType } from '../config-provider/SizeContext';
|
||||
import SizeContext from '../config-provider/SizeContext';
|
||||
|
Loading…
Reference in New Issue
Block a user