Partage de technologie

L'interface de débogage frontale a renvoyé Promise

2024-07-12

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

Le projet doit renvoyer une invite contextuelle, le code suivant :

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

promesse de sortie
Insérer la description de l'image ici

raison:

Après avoir appelé l'interface, le résultat n'est pas renvoyé.

solution:

Ajouter asynchrone et attendre

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