Technologieaustausch

Die Front-End-Debugging-Schnittstelle hat Promise zurückgegeben

2024-07-12

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

Das Projekt muss eine Popup-Eingabeaufforderung mit dem folgenden Code zurückgeben:

const onProductSubmit = async () => {
  const followById = await Open1688Api.updateProductFollowById(formData);
  console.log('followById : ' + followById.toString())
  alert(followById)
}
  • 1
  • 2
  • 3
  • 4
  • 5

Leistungsversprechen
Fügen Sie hier eine Bildbeschreibung ein

Grund:

Nach dem Aufruf der Schnittstelle wird das Ergebnis nicht zurückgegeben.

Lösung:

Async hinzufügen und warten

const onProductSubmit = async () => {
  const followById = await Open1688Api.updateProductFollowById(formData);
  console.log('followById : ' + followById.toString())
  alert(followById)
}
  • 1
  • 2
  • 3
  • 4
  • 5