mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-26 01:42:30 +08:00
28 lines
576 B
TypeScript
28 lines
576 B
TypeScript
|
import React from 'react';
|
||
|
import { Select } from 'antd';
|
||
|
|
||
|
const handleChange = (value: { value: string; label: React.ReactNode }) => {
|
||
|
console.log(value); // { value: "lucy", key: "lucy", label: "Lucy (101)" }
|
||
|
};
|
||
|
|
||
|
const App: React.FC = () => (
|
||
|
<Select
|
||
|
labelInValue
|
||
|
defaultValue={{ value: 'lucy', label: 'Lucy (101)' }}
|
||
|
style={{ width: 120 }}
|
||
|
onChange={handleChange}
|
||
|
options={[
|
||
|
{
|
||
|
value: 'jack',
|
||
|
label: 'Jack (100)',
|
||
|
},
|
||
|
{
|
||
|
value: 'lucy',
|
||
|
label: 'Lucy (101)',
|
||
|
},
|
||
|
]}
|
||
|
/>
|
||
|
);
|
||
|
|
||
|
export default App;
|