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

234
Views
¿Cómo mutan los datos en el método calculado?

Estoy en Vue 3. Tengo un método onclick que se supone que modifica el valor de mis accesorios, que es un valor booleano, lo he intentado de varias maneras, logro ingresar el método calculado, pero el valor de mis accesorios no cambia

registro mis datos

 data() { return { showConsommationWindow: false } }

luego probé 3 formas de cambiar el valor pero ninguna funcionó. El primero :

 <submit-button v-on:click="showConsommationWindow = true" />

el 2do: (la alerta se ejecuta pero el valor de los datos no cambia)

 <submit-button v-on:click="showConsommation(true)"/> methods: { showConsommation(boolValue){ alert('false') this.showConsommationWindow = boolValue; } }

El último :

 <submit-button v-on:click="showConsommation"/> methods: { showConsommation(){ if (!this.showConsommationWindow) { alert('false') this.showConsommationWindow = true; return } this.showConsommationWindow = false; } },

Realmente no entiendo por qué mis datos no pueden mutar, gracias por su ayuda.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Si el valor proviene de accesorios, significa que el padre distribuye un valor booleano al componente . Entonces, si desea cambiar el valor booleano, probablemente debería hacerlo:

 // in parent <Component :booleanValue="myBoolean" @changeBooleanValueEvent="changeMyBoolean" /> ... data() { return { myBoolean: true } } methods: { changeMyBoolean(value) { this.myBoolean = value } } // in component props: { booleanValue: { ... } } methods: { showConsommation() { this.$emit('changeBooleanValueEvent', false) } }

over 4 years ago · Santiago Trujillo 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!