限制输入框数字的范围和大小
<el-input
type=“number”
max=“2147483647”
min=“0”
@input=“numberMax(arguments[0], 2147483647)”
@change=“numberMax(arguments[0], 2147483647)”
v-model=“settingForm.storeCount”
placeholder=“请输入内容”
>
方法:
numberMax(val, maxNum) {
this.settingForm.storeCount = Number(val);
this.$nextTick(() => {
let num = Math.min(Number(val), maxNum);
if (num < 0) {
this.settingForm.storeCount = 0;
} else {
this.settingForm.storeCount = num;
}
});
},