import JSONBig from 'json-bigint'         //json-binint插件可以处理js有效数字超出问题
const request = axios.create({
  baseURL: 'http://ttapi.research.itcast.cn/', // 基础路径
  // 自定义后端返回的原始数据
  // data: 后端返回的原始数据,说白了就是 JSON 格式的字符串
  transformResponse: [function (data) {
    try {
      return JSONBig.parse(data)
    } catch (err) {
      return data
    }

    // axios 默认会在内部这样来处理后端返回的数据
    // return JSON.parse(data)
  }]
})

 

相关文章:

  • 2022-12-23
  • 2021-09-22
  • 2023-01-30
  • 2022-01-24
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
猜你喜欢
  • 2022-12-23
  • 2021-10-26
  • 2022-12-23
  • 2022-12-23
  • 2021-08-12
  • 2022-12-23
  • 2022-02-24
相关资源
相似解决方案