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

321
Views
¿Cómo actualiza una interpolación vue usando un método onclick?

Estoy luchando por actualizar la interpolación de la thing . Esta función simple debería cambiar el valor de los datos, pero en cambio no hace nada. Chrome registra el cambio de cosa en la consola pero el HTML no se actualiza.

 <template> <div class="container-xl pb-5"> <button class="mb-2 btn-lg selected-dropdown" @click="dropSelect('B')"> {{ thing }} </button> </div> </template> <script lang="ts"> import { defineComponent } from "vue"; export default defineComponent({ data() { return { thing: "A", }; }, methods: { dropSelect(thing: any) { console.log(thing); return this.thing; }, }, }); </script>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Intente actualizar su propiedad de datos en lugar de devolver:

 dropSelect(thing: any) { this.thing = thing },
about 4 years ago · Juan Pablo Isaza Report

0

Una pequeña observación : use this.thing = thing en lugar de return this.thing

demostración :

 new Vue({ el: '#app', data: { thing: "A" }, methods: { dropSelect(thing) { this.thing = thing; } } })
 <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script> <div id="app"> <button @click="dropSelect('B')"> {{ thing }} </button> </div>

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!