the function that non-numeric characters cannot be entered in the input box of the weex project cannot be implemented
the code is as follows:
<template>
<input class="login-phone" type="number" placeholder="" maxlength="11" :value="phone" @input="inputPhone" ref="aaaa">
</template>
<script>
created () {
storage.getItem("phone", e => {
if (e.result === "success") {
this.phone = e.data
}
})
},
methods: {
inputPhone (event) {
// event.target= event.value.replace(/\D/g, "") //
// this.phone = event.value.replace(/\D/g, "") //
/** this.$refs.aaaa.setTextFormatter({
formatRule: "/(\d)(\D)/g",
formatReplace: "$1",
recoverRule: "/\D/g",
recoverReplace: ""
}) */ //
this.phone = event.value
}
}
</script>