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

440
Views
¿Cómo ver el valor de la casilla de verificación en vue?

Creo algunas casillas de verificación dinámicas con vue y se ven así;

 <li v-for="element in checklist" :key="element.id" class="block w-full p-1"> <div v-if="element.taskId == task" class="w-full border-2 rounded-md p-4"> <div class="float-right"> <button @click="deleteCheck(element.id)"> <Trash2Icon class="px-1"/> </button> </div> <div class="flex"> <input type="checkbox" id="checkbox" v-model="element.checked" class="w-6"> <label for="checkbox" class="px-2">{{element.content}}</label> </div> </div> </li>

Quiero ver el valor "element.checked" con la función watch() en vue y quiero publicarlo en la API usando axios . y se ve tal vez así;

 watch: { element.checked() { // doesn't work axios.put('api/blabla' + element.id, // I'm not sure here, I'm just trying to compare checked: this.element.checked }) .catch(err => { console.log(err) }) } }

Solo estoy buscando un método, podría ser diferente. el código anterior es solo un elemento de suposición. La verificación da un error.

por cierto, mi lista de verificación parece;

 "checklist": [ { "content": "lorem ipsum dolor", "checked": true, "id": 1 }, { "content": "lorem ipsum dolor sit", "checked": false, "id": 2 }, ]```
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No necesita usar un reloj aquí... todo lo que necesita hacer es vincular un evento @change como

 <input type="checkbox" id="checkbox" v-model="element.checked" @change="customMethod" class="w-6">

y en métodos

 methods: { customMethod() { axios.put('api/blabla' + element.id, checked: this.element.checked }) .catch(err => { console.log(err) }) }
about 4 years ago · Juan Pablo Isaza Report
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!