how do I ensure that only the amount can be entered in the input for mobile vue projects? Including numbers and decimal points. It is found that if you adjust type="tel", there are only numbers but no decimal point, and type="number" has other symbols. It is not possible to monitor input actions to remove symbols. I don"t know if it is the problem with my own code.
<input ref="content" type="number" pattern="[0-9]{,6}" @input="handleAmountChange" v-model.number.trim="money" />
handleAmountChange(e) {
this.money = e.target.value.replace(/[^\d]/g, "")
// .
this.money = this.money.replace(/^\./g, "0.")
// ..
this.money = this.money.replace(/\.{2,}/g, ".")
// .
this.money = this.money
.replace(".", "$-sharp$")
.replace(/\./g, "")
.replace("$-sharp$", ".")
//
this.money = this.money.replace(/^()*(\d+)\.(\d\d).*$/, "$1$2.$3")
},