axios IE9+下数据接收不正常

因为我们是mac开发。当时就忘记测试了ie 在ie9+浏览器的表现是 没有任何报错。。
就是接不到接口数据。
接口有数据并且发出请求有返回值

// 添加响应拦截器 response请求
fetch.interceptors.response.use(
  function(response) {
    // 对响应数据做点什么
    if (typeof response === 'string') {
      response = JSON.parse(response)
    }

我怀疑是response 问题 加了拦截器转换没有用..

import 'es6-promise/auto'
import Vue from 'vue'
import App from './App'
import router from './router

main.js里面也加入了es6-promise 的兼容

getUpdateUserInfo() {
      api.getUserInfoApi().then(res => {
        if (res.data.code === ERR_OK) {
          this.userinfo = res.data.data
          if (this.userinfo.birthday == '0000-00-00') {
            this.userinfo.birthday = new Date().getTime()
          }
          this.isShow = true
          this.setCityList(this.userinfo.places.top)
          if (this.userinfo.places.son == 0) {
            this.userinfo.places.son = '无数据'
          }
        } else {
          console.log('接口返回失败,错误码:' + res.data.code)
        }
      })
    },

在ie上看到的效果就是
clipboard.png
还没有报错...
求大神指导

阅读 5.6k
7 个回答

我也是这样,请问你解决了这个问题嘛?

 api.getUserInfoApi().then(res => {
console.log(res) //加这一句,先打出来看看,是什么东西
        if (res.data.code === ERR_OK) {

如果有跨域访问的话,可能IE下需要多个p3p头

应该是跨域问题,你看看 结果是不是走的.catch()
图片描述

ie兼容跨域问题

新手上路,请多包涵

遇到一样的问题,polyfill也都加了,爆炸

拒绝ie (严肃脸)

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题