//html <input type="number" class="form-control" @keypress="isNumberKey($event)"> //js isNumberKey(e){ if (e.charCode === 0 || /d/.test(String.fromCharCode(e.charCode))) { return true } else { e.preventDefault(); } }