Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
max and min not working on custom input component in VueJS

I developed a custom input component, when I try to use it on a parent component, default input attributes max and min do not work. Here is my custom input element on the parent component

text-field(v-model="level" type="number" max="9" min="0" label="User Level" @beforeinput="onKeyup")

I saw that max and min not working that's why I wrote a function for the beforeInput event to prevent the user enter a number bigger than 9 and a string

 onKeyup(event: InputEvent) {
  const el = event.target as HTMLInputElement
  const value = +el.value
  console.log(value)
  if (value < 0 || value > 9) event.stopImmediatePropagation()
}

This function prevents users from entering string values but does not prevent users to enter a number bigger than 9. How can I fix this?

PS: I am using VueJS 3

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!