Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <input type="text" v-on:keypress="isNumber"/>
- methods: {
- isNumber:function($event){
- let keyCode = ($event.keyCode ? $event.keyCode : $event.which);
- if ((keyCode < 48 || keyCode > 57) && keyCode !== 46) { // 46 is dot
- $event.preventDefault();
- }
- }
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement