标签:required trigger red back 案例 turn return list 无限
mediumint:只能是整数
const amountVal = parseFloat( this.formInline.formInlineList[1].formInlineVal ); const quantityVal = parseInt( this.formInline.formInlineList[3].formInlineVal ); const lowestExpenseAmountVal = parseFloat( this.formInline.formInlineList[2].formInlineVal);
data中: var checkNumber = (rule, value, callback) => { if (!value) { return callback(new Error("请输入优惠面值")); } if (value && value !== "") { let regEn = /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/; if (!regEn.test(value)) { callback(new Error("请输入数字可以是小数且大于0")); } else { callback(); } } else { callback(); } }; var checkNumber1 = (rule, value, callback) => { if (!value) { return callback(new Error("请输入发行数量")); } if (value && value !== "") { let regEn = /^[1-9]\d*$/; if (!regEn.test(value)) { callback(new Error("请输入数字必须是整数且大于0")); } else { // callback(); if (value > 999) { callback(new Error("超出999限制")); } else { callback(); } } } else { callback(); } };
rules中: rules: { formInlineVal: [ { required: true, validator: 上方正则判断定义的变量, trigger: "blur" } ] }
标签:required trigger red back 案例 turn return list 无限
原文地址:https://www.cnblogs.com/home-/p/11697572.html