2023-08-30 21:28:45 +08:00
|
|
|
import React from 'react';
|
2023-12-08 20:14:39 +08:00
|
|
|
import { Segmented, Tabs } from 'antd';
|
2023-08-30 21:28:45 +08:00
|
|
|
import type { TabsProps } from 'antd';
|
|
|
|
|
|
|
|
const onChange = (key: string) => {
|
|
|
|
console.log(key);
|
|
|
|
};
|
|
|
|
|
|
|
|
const items: TabsProps['items'] = [
|
2024-01-05 10:56:11 +08:00
|
|
|
{ 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' },
|
2023-08-30 21:28:45 +08:00
|
|
|
];
|
|
|
|
|
2024-01-05 10:56:11 +08:00
|
|
|
type Align = 'start' | 'center' | 'end';
|
|
|
|
|
2023-12-08 20:14:39 +08:00
|
|
|
const App: React.FC = () => {
|
2024-01-05 10:56:11 +08:00
|
|
|
const [alignValue, setAlignValue] = React.useState<Align>('center');
|
2023-12-08 20:14:39 +08:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Segmented
|
2024-10-22 10:09:31 +08:00
|
|
|
value={alignValue}
|
2023-12-08 20:14:39 +08:00
|
|
|
style={{ marginBottom: 8 }}
|
2024-10-22 10:09:31 +08:00
|
|
|
onChange={setAlignValue}
|
2023-12-08 20:14:39 +08:00
|
|
|
options={['start', 'center', 'end']}
|
|
|
|
/>
|
|
|
|
<Tabs
|
|
|
|
defaultActiveKey="1"
|
|
|
|
items={items}
|
|
|
|
onChange={onChange}
|
2024-01-05 10:56:11 +08:00
|
|
|
indicator={{ size: (origin) => origin - 20, align: alignValue }}
|
2023-12-08 20:14:39 +08:00
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
2023-08-30 21:28:45 +08:00
|
|
|
|
|
|
|
export default App;
|