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

116
Views
Reactividad y datos de vue.js con mixin

Estoy tratando de establecer un indicador que puede ser un valor booleano true o false según ciertas condiciones.

 // main.js new Vue({ el: `#app`, render: h => h(App,{ props:{ todoID: this.dataset.id } }) })

mi script de aplicación

 export default { name: 'App', props: { todoID: String, }, data() { return { isDone: false // here is the initial flag } }, ...

Creé un método mixin

 import Vue from "vue"; Vue.mixin({ methods: { isCompleted() { if (myconditions){ this.isDone = true; // I want to change the flag to true } }, }, });

en mi plantilla si hago {{isDone}} siempre obtengo falso, ¿cómo puedo cambiar esto para que sea reactivo para que pueda cambiarse según las condiciones?

Aquí hay una demostración que creé: https://codesandbox.io/embed/vigorous-bell-p1itu?fontsize=14&hidenavigation=1&theme=dark

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

 Vue.mixin({ methods: { isCompleted(myconditions) { console.log(myconditions); console.log(typeof myconditions); return this.isDone = myconditions; // I want to change the flag to true }, }, }); new Vue({ el: '#vue-app', data: { isDone: false } });
 <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script> <div id="vue-app"> <p> result = {{ isCompleted(true) }}</p> </div> </body>

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!