Commit f827a749 authored by 李腾's avatar 李腾

feat: 限制商品数量输入框

parent d8f84003
...@@ -88,6 +88,15 @@ const FormComponent = (props, ref) => { ...@@ -88,6 +88,15 @@ const FormComponent = (props, ref) => {
); );
}; };
const onInput = e => {
if (e.target.value === '') {
return;
}
if (e.target.value <= 0) {
e.target.value = 1;
}
};
const SkuFormList = skuProps => { const SkuFormList = skuProps => {
const { skuFields, parentFields, errors } = skuProps; const { skuFields, parentFields, errors } = skuProps;
return ( return (
...@@ -98,7 +107,7 @@ const FormComponent = (props, ref) => { ...@@ -98,7 +107,7 @@ const FormComponent = (props, ref) => {
{getSkuOptions(field.name, parentFields.name)} {getSkuOptions(field.name, parentFields.name)}
</Form.Item> </Form.Item>
<Form.Item className={styles['sku-list__goods-count']} name={[field.name, 'quantity']}> <Form.Item className={styles['sku-list__goods-count']} name={[field.name, 'quantity']}>
<Input type="number" placeholder="数量" /> <Input type="number" onInput={onInput} placeholder="数量" />
</Form.Item> </Form.Item>
</div> </div>
))} ))}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment