此处input的type为digit
<input v-model="amount" type="digit" placeholder="请填写金额" @input="checkAmount"/>
data() {return {amount:""}
}
methods: {// 小数点后2位checkAmount(e){e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || nullthis.$nextTick(() => {this.amount = e})},
}