mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-06 05:58:46 +08:00
46 lines
1.0 KiB
TypeScript
46 lines
1.0 KiB
TypeScript
|
import React from 'react';
|
||
|
import type { SelectProps } from 'antd';
|
||
|
import { Divider, Select, Typography } from 'antd';
|
||
|
|
||
|
const { Title } = Typography;
|
||
|
|
||
|
const options: SelectProps['options'] = [];
|
||
|
for (let i = 0; i < 100000; i++) {
|
||
|
const value = `${i.toString(36)}${i}`;
|
||
|
options.push({
|
||
|
label: value,
|
||
|
value,
|
||
|
disabled: i === 10,
|
||
|
});
|
||
|
}
|
||
|
|
||
|
const handleChange = (value: string[]) => {
|
||
|
console.log(`selected ${value}`);
|
||
|
};
|
||
|
|
||
|
const App: React.FC = () => (
|
||
|
<>
|
||
|
<Title level={3}>Ant Design 4.0</Title>
|
||
|
<Title level={4}>{options.length} Items</Title>
|
||
|
<Select
|
||
|
mode="multiple"
|
||
|
style={{ width: '100%' }}
|
||
|
placeholder="Please select"
|
||
|
defaultValue={['a10', 'c12']}
|
||
|
onChange={handleChange}
|
||
|
options={options}
|
||
|
/>
|
||
|
|
||
|
<Divider />
|
||
|
|
||
|
<Title level={3}>Ant Design 3.0</Title>
|
||
|
<iframe
|
||
|
title="Ant Design 3.0 Select demo"
|
||
|
src="https://codesandbox.io/embed/solitary-voice-m3vme?fontsize=14&hidenavigation=1&theme=dark&view=preview"
|
||
|
style={{ width: '100%', height: 300 }}
|
||
|
/>
|
||
|
</>
|
||
|
);
|
||
|
|
||
|
export default App;
|