Vue limit number if it is not a number prompt, please enter a number

<input v-on:input="submit" type="text" placeholder="" @keydown="handleInput" v-model.trim="info.inviteCode">
handleInput(e) {
                if(/[^\d]/.test(this.info.inviteCode)){
                    console.log(123)
                }
                // e.target.value = e.target.value.replace(/[^\d]/g, "");
            }

Why doesn"t my judgment work

console.log(/[^\d]/.test(e.target.value)

will appear to first enter the number is true and then enter the first letter will appear true the second letter will become false, but then enter the number will always console out the false.

Jun.10,2022

/ ^\ dcards. G


just let you enter numbers: input type just use phone

you bind both the input event and the keydown event, which will be triggered when you type.

in addition. @ keydown= "handleInput ($event)"


<input  type="number" >
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b38859-2c135.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b38859-2c135.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?