一、结构
<el-form-item label="单价:" prop="price"><el-inputv-model.trim="formData.price"placeholder="请输入"@blur="formMethod.fixTwo"><template #append>(元)</template></el-input></el-form-item>
二、验证方法:
//@blur="formMethod.fixTwo"的方法保证两位小数
fixTwo:(val)=>{let centerNum = Number(val.target.value)if(val.target.value == 0 || val.target.value == "0"){val.target.value == 0}els