showing results for - "input will get only number vue"
Benjamin
11 Jan 2019
1<div id="demo">
2  <input v-model="message" @keypress="isNumber($event)">
3</div>
4
Erwann
25 Feb 2017
1 <input @keypress="onlyNumber" type="text">
2
3onlyNumber ($event) {
4   //console.log($event.keyCode); //keyCodes value
5   let keyCode = ($event.keyCode ? $event.keyCode : $event.which);
6   if ((keyCode < 48 || keyCode > 57) && keyCode !== 46) { // 46 is dot
7      $event.preventDefault();
8   }
9}
10