1 | import React from "react";
|
2 | import { InputNumber } from "antd";
|
3 | /**
|
4 | * ----------------------------------------
|
5 | * 数字
|
6 | * @param {String} suffix - 后缀
|
7 | * ----------------------------------------
|
8 | */
|
9 | export default function InputNumberBox({ suffix = "", ...rest }) {
|
10 | const options = {};
|
11 | if (suffix) {
|
12 | options.formatter = v => `${v}${suffix}`;
|
13 | options.parser = v => v.replace(suffix, "");
|
14 | }
|
15 | return <InputNumber min={0} {...options} {...rest} />;
|
16 | }
|
17 |
|
\ | No newline at end of file |