mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-16 01:41:02 +08:00
1548f44ef8
* docs: add debug demo for segmented * chore: update * feat: upgrade rc-segmented v2 * Update components/segmented/__tests__/index.test.tsx Co-authored-by: afc163 <afc163@gmail.com> * Update components/segmented/demo/controlled-two.md Co-authored-by: afc163 <afc163@gmail.com> Co-authored-by: afc163 <afc163@gmail.com>
28 lines
445 B
Markdown
28 lines
445 B
Markdown
---
|
|
order: 0
|
|
title:
|
|
zh-CN: 受控模式
|
|
en-US: Controlled mode
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
受控的 Segmented。
|
|
|
|
## en-US
|
|
|
|
Controlled Segmented.
|
|
|
|
```tsx
|
|
import React, { useState } from 'react';
|
|
import { Segmented } from 'antd';
|
|
|
|
const Demo: React.FC = () => {
|
|
const [value, setValue] = useState<string | number>('Map');
|
|
|
|
return <Segmented options={['Map', 'Transit', 'Satellite']} value={value} onChange={setValue} />;
|
|
};
|
|
|
|
export default Demo;
|
|
```
|