Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
docs: add debug demo for segmented (#35176)
* docs: add debug demo for segmented * chore: update * chore: update
- Loading branch information
Showing
3 changed files
with
241 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
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={e => setFoo(e.target.value)} | ||
/> | ||
| ||
<Segmented | ||
value={foo} | ||
options={['AND', 'OR', 'NOT']} | ||
onChange={e => setFoo(e.target.value)} | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default Demo; | ||
``` |