通过正则表达式 限制输入框 只能录入数字和小数点,且小数点后只能录入两位小数,
input 上绑定input事件,
<el-input @input="numberFn('itemBudget')" v-model=""></el-input>
<el-input @input="numberFn('itemTotalInvestment')" v-model=""></el-input>
<el-input @input="numberFn('itemGroupInvestment')" v-model=""></el-input>
numberFn(p){
[p] = [p]
.replace(/[^\d^\.]+/g, '')
.replace(/^0+(\d)/, '$1')
.replace(/^\./, '0.')
.match(/^\d*(\.?\d{0,2})/g)[0] || ''
},