mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
docs: Update demo (#39127)
This commit is contained in:
parent
aa1945d9ae
commit
88e360d79d
@ -17,22 +17,29 @@ Using `OptGroup` to group the options.
|
||||
import { Select } from 'antd';
|
||||
import React from 'react';
|
||||
|
||||
const { Option, OptGroup } = Select;
|
||||
|
||||
const handleChange = (value: string) => {
|
||||
console.log(`selected ${value}`);
|
||||
};
|
||||
|
||||
const App: React.FC = () => (
|
||||
<Select defaultValue="lucy" style={{ width: 200 }} onChange={handleChange}>
|
||||
<OptGroup label="Manager">
|
||||
<Option value="jack">Jack</Option>
|
||||
<Option value="lucy">Lucy</Option>
|
||||
</OptGroup>
|
||||
<OptGroup label="Engineer">
|
||||
<Option value="Yiminghe">yiminghe</Option>
|
||||
</OptGroup>
|
||||
</Select>
|
||||
<Select
|
||||
defaultValue="lucy"
|
||||
style={{ width: 200 }}
|
||||
onChange={handleChange}
|
||||
options={[
|
||||
{
|
||||
label: 'Manager',
|
||||
options: [
|
||||
{ label: 'Jack', value: 'jack' },
|
||||
{ label: 'Lucy', value: 'lucy' },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Engineer',
|
||||
options: [{ label: 'yiminghe', value: 'Yiminghe' }],
|
||||
},
|
||||
]}
|
||||
/>
|
||||
);
|
||||
|
||||
export default App;
|
||||
|
Loading…
Reference in New Issue
Block a user