reactjs - 为什么 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);
})
我除了帖子可以从端点返回值。
解决方案
推荐阅读
- scala - Gatling:在开始模拟之前尝试检查后端是否已启动
- python-3.x - 如何将 str 转换为浮点数?
- spring - intellij - Spring 应用程序上下文依赖关系图
- generics - 是否可以使用泛型针对不同的特征以不同的方式实现相同的方法?
- sql - 为一组员工设置 Disabled 为 True
- java - 保持矩形的角准确
- r - 依赖项 'caTools' 不适用于包 'gplots'
- ruby-on-rails - Rails 强参数 - 缓存 .require 和 .permit 的结果有什么好处?
- java - 如何使用 Micronaut Security 过滤请求?[Micronaut 安全 1.3.1]
- r - 根据R中一行中的数字重复采样