ant-design/components/input-number/demo/addon.tsx
二货爱吃白萝卜 2cdf586291
chore: fix lint (#43873)
* chore: fix lint

* chore: fix lint

* test: fix 16

* fix: lint
2023-07-28 16:17:43 +08:00

50 lines
1.3 KiB
TypeScript

import { SettingOutlined } from '@ant-design/icons';
import React from 'react';
import { Cascader, InputNumber, Select, Space } from 'antd';
const { Option } = Select;
const selectBefore = (
<Select defaultValue="add" style={{ width: 60 }}>
<Option value="add">+</Option>
<Option value="minus">-</Option>
</Select>
);
const selectAfter = (
<Select defaultValue="USD" style={{ width: 60 }}>
<Option value="USD">$</Option>
<Option value="EUR"></Option>
<Option value="GBP">£</Option>
<Option value="CNY">¥</Option>
</Select>
);
const App: React.FC = () => (
<Space direction="vertical">
<InputNumber addonBefore="+" addonAfter="$" defaultValue={100} />
<InputNumber addonBefore={selectBefore} addonAfter={selectAfter} defaultValue={100} />
<InputNumber addonAfter={<SettingOutlined />} defaultValue={100} />
<InputNumber
addonBefore={<Cascader placeholder="cascader" style={{ width: 150 }} />}
defaultValue={100}
/>
<InputNumber
addonBefore="+"
addonAfter={<SettingOutlined />}
defaultValue={100}
disabled
controls
/>
<InputNumber
prefix="¥"
addonBefore="+"
addonAfter={<SettingOutlined />}
defaultValue={100}
disabled
controls
/>
</Space>
);
export default App;