input-number cannot be automatically cleared when the input value is not within the range
- [ ] I have searched the issues of this repository and believe that this is not a duplicate.
Version
2.2.6
Environment
ant-design-vue:2.2.6 vue:3.0.0
Reproduction link
Steps to reproduce
需求是当输入值不在范围内则清空表单值
What is expected?
输入值不在范围内,清空表单,保持聚焦
What is actually happening?
输入值不在范围内,如果未失焦,视图中的值未发生改变;如果失焦,则显示正常
临时方案
inputNumber.value.blur();
nextTick(() => {
valueRef.value = '';
inputNumber.value.focus();
});
Form validation rules are not working for min and max range validation, if the typed value exceeds the max value it returns max value in the validation rule that's it not give any error.
Is there any way to apply the min max validation rule and display an error in form validation for InputNumber?
Form validation rules are not working for min and max range validation, if the typed value exceeds the max value it returns max value in the validation rule that's it not give any error.
Is there any way to apply the min max validation rule and display an error in form validation for InputNumber?
I have the same issuse!
i find a solution:
<a-input-number :disabled="record.disable" placeholder="请输入" v-model:value="text.xybhd" @blur="(e) => checkValue(e.target.value, 70, 100)" :min="70" :max="100" />
function checkValue(value, min, max) { console.log(value, min, max) const flag = value < min || value > max if (flag) { message.warning('数值异常,请确认或重新输入') } }