uni-app中的input限制输入两位小数
<input v-model="inputAmount" type="digit" @input="replaceInput" />
replaceInput(event) { // 必须在nextTick中 this.$nextTick(() => { this.inputAmount = event.target.value.match(/^\d*(\.?\d{0,2})/g)[0] }) }
<input v-model="inputAmount" type="digit" @input="replaceInput" />
replaceInput(event) { // 必须在nextTick中 this.$nextTick(() => { this.inputAmount = event.target.value.match(/^\d*(\.?\d{0,2})/g)[0] }) }