小數(shù)點后位數(shù)不限制
@input="
item.applyForBudget = item.applyForBudget
.replace(/[^\d|.]/g, '')
.replace(/^00/g, '0')
.replace(/^./g, '0.')
"
小數(shù)點后兩位
.replace(/[\d.]+/g, '')
.replace(/^0+(\d)/, '$1')
.replace(/^./, '0.')
.match(/^\d*(.?\d{0,2})/g)[0] || ''
只允許輸入正數(shù)
.replace(/[^\d]+/g, '') // 只保留數(shù)字
.replace(/^0+(\d)/, '$1') // 去除前導零