<el-form-item label="支出金额" prop="exMoney">
<el-input v-model="form.exMoney" placeholder="请输入支出金额(万元)" @input="numberFn('exMoney')" />
</el-form-item>
numberFn(p) {
this.form[p] = this.form[p]
.replace(/[^\d^\.]+/g, '')
.replace(/^0+(\d)/, '$1')
.replace(/^\./, '0.')
.match(/^\d*(\.?\d{0,2})/g)[0] || ''
},
input限制输入小数点后2位
最新推荐文章于 2024-06-06 16:33:14 发布