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

170
Views
Los campos cargados no se inicializan en la función adicional

Uso dos funciones para cargar algunos componentes para mi página y guardarlos en dos campos representantes y todos los usuarios. Luego trato de usar funciones adicionales subtractSets() para modificar un poco los datos cargados. Mi problema es que los campos this.representatives y this.allUsers en esta función adicional aún no están inicializados. ¿Qué puedo hacer para cargar datos en subtractSets()?

 setup() { const representatives = ref([]) const allUsers = ref([]) data() { return { representatives, users } } }, methods(): { loadUsersRepresentatives() { axios.get('getRepresentatives').then(res => { this.representatives = res.data }).catch(() => { ... }) }); }, loadAllUsers() { axios.get('/getAllUsers').then(res => { this.allUsers = res.data }).catch(() => { ... }) }); }, subtractSets(obj1, obj2) { ... }, showRepresentativesDialog(facultyID) { this.loadUsersRepresentatives(facultyID) this.loadAllUsers() this.subtractSets(this.representatives, this.allUsers) this.representativesDialog = true } }, ´´´
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Te estás perdiendo async / await

 methods(): { async loadUsersRepresentatives() { return axios.get('getRepresentatives').then(res => { this.representatives = res.data }).catch(() => { ... }) }); }, async loadAllUsers() { return axios.get('/getAllUsers').then(res => { this.allUsers = res.data }).catch(() => { ... }) }); }, subtractSets(obj1, obj2) { ... }, async showRepresentativesDialog(facultyID) { await this.loadUsersRepresentatives(facultyID) await this.loadAllUsers() this.subtractSets(this.representatives, this.allUsers) this.representativesDialog = true } },
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!