vue项目中想调用阿里云的天气预报接口。看了axios后一头雾水啊,如果单纯一个api接口我试过自己调用。但阿里云里面还需要一个api签名认证。阿里天气预报api地址麻烦各位大佬帮我看下才能调用里面的数据,谢谢!
axios.get(url[, config]),经过@浮囡的提醒,我把header写在config里面就可以了。
axios.get('http://jisutqybmf.market.alicloudapi.com/weather/query?city=%E5%B9%BF%E5%B7%9E',{
headers:{
"Authorization": "APPCODE xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }
}).then(function (response) {
console.log(response);
})
这里再次谢谢浮囡的回答