原因是:
服务端请求 后端接收到 请求 ‘Content-Type’: ‘application/x-www-form-urlencoded; charset=UTF-8’ 直接返回错误的code 200000

增加 data: {}
服务端请求 后端接收到 请求 ‘Content-Type’: ‘application/json; charset=UTF-8’
服务端请求就可以得到数据

export function getCategoryList() {
  return request({
    method: 'POST',
    url: '/test/demo/category',
    data: {} 
  })
}

后端接口如果 使用了 @RequestBody注解就必须是json格式
在这里插入图片描述

如果后端接口没有则可以不加 data: {}

在这里插入图片描述

export function getCategoryList() {
  return request({
    method: 'POST',
    url: '/test/demo/category',
  })
}
Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐