VUE axios请求接口数据时相应undefined

1.这是对axios进行的二次封装的代码(这部分代码是在request.js中)

VUE axios请求接口数据时相应undefined_第1张图片

2.这是对API统一请求的代码

import requests  from "./request.js";
//对请求接口进行封装
export  const  userinfor_by_get = ()=>requests({url:'/approuter/user/',method:'get'});

3.在vue文件中对接口进行请求 ,如果请求的方法这样写是没有错的,如果想用res引用任何信息 就会提示undefined

export  default {
'''''''
methods: {
    userinfordat_show(){
        userinfor_by_get().then(res=>{
            console.log("请求数据");
            this.getValue=res;
            console.log("GET请求测试获取值: ",res);
        })
    },

}

你可能感兴趣的:(python,vue.js,前端,javascript)