2019-09-12 20:15:17 +08:00
---
2020-12-25 13:13:07 +08:00
order: 25
2019-09-12 20:15:17 +08:00
title:
zh-CN: 大数据
en-US: Big Data
---
## zh-CN
Select 使用了[虚拟滚动](https://github.com/react-component/virtual-list)技术,因而获得了比 [3.0 更好的性能 ](https://codesandbox.io/s/beautiful-banzai-m72lv )。
## en-US
Select use [virtual scroll ](https://github.com/react-component/virtual-list ) which get better performance [than 3.0 ](https://codesandbox.io/s/beautiful-banzai-m72lv ).
2022-05-19 09:46:26 +08:00
```tsx
import type { SelectProps } from 'antd';
2022-05-23 14:37:16 +08:00
import { Divider, Select, Typography } from 'antd';
import React from 'react';
2019-09-12 20:15:17 +08:00
const { Title } = Typography;
2022-05-19 09:46:26 +08:00
const options: SelectProps['options'] = [];
2019-09-12 20:15:17 +08:00
for (let i = 0; i < 100000 ; i + + ) {
const value = `${i.toString(36)}${i}` ;
options.push({
2022-05-19 09:46:26 +08:00
label: value,
2019-09-12 20:15:17 +08:00
value,
disabled: i === 10,
});
}
2022-05-19 09:46:26 +08:00
const handleChange = (value: string[]) => {
2019-09-12 20:15:17 +08:00
console.log(`selected ${value}`);
2022-05-19 09:46:26 +08:00
};
2019-09-12 20:15:17 +08:00
2022-05-19 09:46:26 +08:00
const App: React.FC = () => (
2020-03-14 00:04:54 +08:00
< >
2019-09-12 20:15:17 +08:00
< 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"
2020-03-10 16:43:23 +08:00
src="https://codesandbox.io/embed/solitary-voice-m3vme?fontsize=14& hidenavigation=1& theme=dark& view=preview"
2019-09-12 20:15:17 +08:00
style={{ width: '100%', height: 300 }}
/>
2022-04-03 23:27:45 +08:00
< />
2019-09-12 20:15:17 +08:00
);
2022-05-19 09:46:26 +08:00
export default App;
2019-09-12 20:15:17 +08:00
```