<input v-model="formData.mealStandard" type="text" @keyup="validateMealStandard($event)" placeholder="请输入"/>
//金额
validateMealStandard(e){
let mealStandard = e.target.value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '');
if (mealStandard>=999999999.99){
this.formData.mealStandard = 999999999.99;
}else {
this.formData.mealStandard=mealStandard;
}
},
//数字
onlyKeepTwoNumberAfterPoint(type) { /*限制格式*/
if(type==1) {
let number = (this.formData.number.match(/^\d*(\.?\d{0,0})/g)[0]);
if (isNaN(number)) { /*非数字*/
this.formData.number = '';
} else {
if (number == '') { /*为空*/
this.formData.number = '';
} else { /*不为空*/
if (number >= 999999999) {
this.formData.number = 999999999;
} else {
this.formData.number = number;
}
}
}
}
},