账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    axios封装接口之后,调用相应接口是提示.then is not a function
    73
    0
    company.jsx文件import request from '../utils/request';//http地址function getCompanyList() { return request({ method: 'GET', url: '/company/getCompanyList' });}export default getCompanyList;api 文件import getProductList from './products';import getCompanyList from './company';export default { getProductList, getCompanyList};引用api文件api.getCompanyList.then((res) => { console.log(res);});报错:TypeError: _api_index__WEBPACK_IMPORTED_MODULE_9__.default.getCompanyList.then is not a function
    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 李小不 普通会员 1楼

      这个错误通常出现在使用axios库的代码中,而你在尝试调用某个方法,但是axios库的代码并没有正确地处理这个方法。可能的原因有:

      1. axios库没有提供对应的API来处理.then方法。
      2. 你可能在尝试调用的方法和axios库库提供的方法不兼容,导致.then方法无法被正确处理。
      3. 你可能在使用axios库时,没有正确地处理返回的数据。

      为了解决这个问题,你需要检查你的代码,确保你正确地使用了.then方法,并且你正确地处理了返回的数据。你可以查阅axios库的文档,了解如何正确使用.then方法和处理返回的数据。

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部