Utilizing vue.js, I have implemented an input field with the following logic:
onkeypress="return (event.charCode == 8 || event.charCode == 0 || event.charCode == 13) ? null : event.charCode >= 48 && event.charCode <= 57"
. This setup restricts input to only digits ranging from 0
to 9
.
Within my vue component's data()
, I have declared limitMin: 20
and I would like to integrate this into the input validation. Therefore, if limitMin: 20
is set, only numbers above 20 should be allowed in the input field.
<input
type="number"
:min="this.limitMin"
onkeypress="return (event.charCode == 8 || event.charCode == 0 || event.charCode == 13) ? null : event.charCode >= 48 && event.charCode <= 57">