mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-16 01:29:11 +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>
34 lines
629 B
Markdown
34 lines
629 B
Markdown
---
|
|
order: 99
|
|
title:
|
|
zh-CN: 受控同步模式
|
|
en-US: Controlled Synced mode
|
|
debug: true
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
测试受控模式下两个 Segmented 同步 state。
|
|
|
|
## en-US
|
|
|
|
Tests two Segmented synchronized states in controlled mode.
|
|
|
|
```jsx
|
|
import { useState } from 'react';
|
|
import { Segmented } from 'antd';
|
|
|
|
const Demo = () => {
|
|
const [foo, setFoo] = useState('AND');
|
|
return (
|
|
<>
|
|
<Segmented value={foo} options={['AND', 'OR', 'NOT']} onChange={setFoo} />
|
|
|
|
<Segmented value={foo} options={['AND', 'OR', 'NOT']} onChange={value => setFoo(value)} />
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default Demo;
|
|
```
|