2016-03-31 09:40:55 +08:00
|
|
|
---
|
2019-12-11 23:32:19 +08:00
|
|
|
order: 11
|
2016-11-11 12:08:18 +08:00
|
|
|
title:
|
2016-06-19 11:17:09 +08:00
|
|
|
zh-CN: 三种大小
|
2016-11-11 12:08:18 +08:00
|
|
|
en-US: Three Sizes
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-12-10 16:12:10 +08:00
|
|
|
|
2016-06-19 11:17:09 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
三种大小的输入框,若不设置,则为 `middle`。
|
2015-12-10 16:12:10 +08:00
|
|
|
|
2016-06-19 11:17:09 +08:00
|
|
|
## en-US
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
The input box comes in three sizes. `middle` will be used if `size` is omitted.
|
2016-06-19 11:17:09 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
|
|
|
import type { RadioChangeEvent } from 'antd';
|
2020-07-30 19:17:34 +08:00
|
|
|
import { DatePicker, Radio, Space } from 'antd';
|
2022-05-19 09:46:26 +08:00
|
|
|
import type { SizeType } from 'antd/es/config-provider/SizeContext';
|
2022-05-23 14:37:16 +08:00
|
|
|
import React, { useState } from 'react';
|
2018-06-27 15:55:04 +08:00
|
|
|
|
2019-12-11 23:32:19 +08:00
|
|
|
const { RangePicker } = DatePicker;
|
2016-11-11 12:08:18 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => {
|
|
|
|
const [size, setSize] = useState<SizeType>('middle');
|
2016-11-11 12:08:18 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const handleSizeChange = (e: RadioChangeEvent) => {
|
2022-05-11 19:43:54 +08:00
|
|
|
setSize(e.target.value);
|
2019-05-07 14:57:32 +08:00
|
|
|
};
|
2016-11-11 12:08:18 +08:00
|
|
|
|
2022-05-11 19:43:54 +08:00
|
|
|
return (
|
|
|
|
<Space direction="vertical" size={12}>
|
|
|
|
<Radio.Group value={size} onChange={handleSizeChange}>
|
|
|
|
<Radio.Button value="large">Large</Radio.Button>
|
2022-05-19 09:46:26 +08:00
|
|
|
<Radio.Button value="middle">middle</Radio.Button>
|
2022-05-11 19:43:54 +08:00
|
|
|
<Radio.Button value="small">Small</Radio.Button>
|
|
|
|
</Radio.Group>
|
|
|
|
<DatePicker size={size} />
|
|
|
|
<DatePicker size={size} picker="month" />
|
|
|
|
<RangePicker size={size} />
|
|
|
|
<DatePicker size={size} picker="week" />
|
|
|
|
</Space>
|
|
|
|
);
|
|
|
|
};
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
export default App;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|