2022-04-23 16:52:48 +08:00
|
|
|
---
|
|
|
|
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 (
|
|
|
|
<>
|
2022-04-23 21:00:05 +08:00
|
|
|
<Segmented value={foo} options={['AND', 'OR', 'NOT']} onChange={setFoo} />
|
2022-04-23 16:52:48 +08:00
|
|
|
|
2022-04-23 21:00:05 +08:00
|
|
|
<Segmented value={foo} options={['AND', 'OR', 'NOT']} onChange={value => setFoo(value)} />
|
2022-04-23 16:52:48 +08:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Demo;
|
|
|
|
```
|