vue表单验证无效,因为能输入负数,所以加了正整数验证,结果获取不到输入内容,验证不通过点击不了提交,这种样子的是第一次写,望大鎶大姐们指点一下,感谢感谢
<el-form-item label="鉴定消费金额" prop="identificationMoney">
<el-input v-model="money[0]" placeholder="最小消费金额" style="width:30%;float:left;" ref="min"></el-input> -
<el-input v-model="money[1]" placeholder="最大消费金额" style="width:30%;" ref="max"></el-input>
</el-form-item>
dataRule() {
var memberMoney = (rule, value, callback) => {
if (value == '') {
return callback(new Error('请填写消费金额'))
}else if(/^[0-9]*$ /.test(value)){
return callback(new Error('请填写数字'))
}
callback()
}
return {
identificationMoney: [
{
required: true,
validator: memberMoney,
trigger: "blur"
}
],
},