首页 > 解决方案 > 为什么 axios post 方法返回 Promise{}?

问题描述

我想在提交函数中的 reactjs 中使用 axios post 方法,但要保持 axios return Promise{}

我尝试将 console.log 放入每一步,但没有人出来。我也尝试更改 fetch ,但遇到了同样的问题。

     let product_Id = this.state.value        
    axios.post('http://localhost:8000/api/debug',{product_Id})
           .then(function(response){
             console.log("response",response)
           })
           .catch(function (error) {
             console.log("catch",error);
           })
           .finally(function(error){
             console.log("finally",error);
           })

我除了帖子可以从端点返回值。

标签: reactjs

解决方案


推荐阅读