【接口测试】axios测试接口

使用axios测试接口(这个是get请求的数据)

axios({
  method:"GET",
  url:"/api/category/product/model-detail-by-model-id-new?entityId=4&modelId=11222&proModelId=13&source=3"
}).then((data)=>{
  console.log(data,6);
})
},


//////////////////////////////////
vue的配置文件中,需要设置跨域请求地址

 devServer:{
        open:true,
        port:9000,
        //服务器代理跨域
        proxy:{
            "/ajax":{
                target:"http://m.maoyan.com",
                changeOrigin:true
            },
            "/locate":{
                target:"http://apimobile.meituan.com",
                changeOrigin:true
            },
            "/api":{
                target:"https://cmsjapi.dataoke.com",
                changeOrigin:true
            }
        }
    },



猜你喜欢

转载自www.cnblogs.com/yuanjili666/p/11603081.html