Trying to implement an input field in vue.js that only accepts integer values, ensures the quantity is not 0, and defaults to 1 if left empty. I attempted to block decimals with the code:
<input type="number" min="1" @keydown="filterKey"></input>
filterKey(e){
const key = e.key;
if (key === '.')
return e.preventDefault();
}
However, I am unsure how to implement the other filters. Any suggestions on how to achieve this?