<InputNumber min={1} max={999} formatter={limitNumber} parser={limitNumber} />
/* 限制数字输入框只能输入整数 */
const limitNumber = value => {
if (typeof value === 'string') {
return !isNaN(Number(value)) ? value.replace(/^(0+)|[^\d]/g, '') : ''
} else if (typeof value === 'number') {
return !isNaN(value) ? String(value).replace(/^(0+)|[^\d]/g, '') : ''
} else {
return ''
}
}