加载api数据时,图片文字无法显示:

created() {

  //请求的ajex地址,成功的回调,拿到一个response

  this.$http.get('/api/seller').then((response) => {

    //response是一个属性,将其转化为json对象

    response = response.json();

    //console.log(response);

    if(response.errno === ERR_OK){

      //数据在data字段中

      this.seller = response.data;

      console.log(this.seller);

    }

  });

}

 

将response.json()方法,改为response.body属性,

因为json()的返回值类型改变了,改用body属性之后通过,是body属性,不是方法,即改为:

response = response.body  

即可成功加载数据

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
  • 2021-06-27
  • 2021-12-26
  • 2022-12-23
  • 2021-12-15
  • 2021-10-04
猜你喜欢
  • 2022-01-24
  • 2022-12-23
  • 2021-09-13
  • 2022-12-23
  • 2022-12-23
  • 2021-06-05
相关资源
相似解决方案