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

206
Views
¿Cómo recibir solo valor de la última solicitud?

En VueJS, tengo un controlador de cambios en un campo de entrada, como se muestra a continuación:

 inputHandler(url, params){ const p = new Promise((resolve, reject) => { const xhr = new XMLHttpRequest(); xhr.open('POST', url, true); ... ... }); p.then(res => this.reactiveProperty = res); }

Entonces, obtengo respuesta y la pongo en una variable reactiva. Envío solicitudes en el orden 1, 2, 3, 4, pero recibo respuestas en el orden 4, 1, 3, 2 (por ejemplo).

Esta es una razón por la que la variable obtiene un valor incorrecto. ¿Cómo podría evitarlo?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede usar async, esperar. Esperará la primera promesa y luego llegará a la segunda, segunda y luego a la tercera... etc. También como dijo @TJ Crowder, deberías usar la API de búsqueda en su lugar.

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!