0 效果
1 代码
{1,5}是用来限制小数点后几位的
addFormRules: {investAmount: [{ validator: checkInvestAmount, trigger: 'blur' }],
},
const checkInvestAmount = (rule, value, callback) => {if (value !== '' && value !== null && value !== undefined) {if (/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/.test(value) == false) {callback(new Error('只允许输入数字,且小数点后两位'));} else {callback();}} else {callback();}
}