Vue axios's request for Baidu Weather api

want to get such weather and time information

clipboard.png
code
created () {

        let obj = {
            baseURL: "http://api.map.baidu.com/telematics/v3/weather",
            method: "post",
            data: {
                location: "", 
                output: "json",
                ak: "eklfHV01LdEBLSrwUAXZRP6Ctr94f8TO" 
            }
        }
        this.axios.post(obj).then( res => {
            console.log(res)
        })
    
    TypeError: relativeURL.replace is not a function
May.02,2022

You don't understand the usage of

axios. You should just change the code

.
this.axios.post('http://api.map.baidu.com/telematics/v3/weather', 
data: {
    location: "", 
    output: "json",
    ak: "eklfHV01LdEBLSrwUAXZRP6Ctr94f8TO" 
})
.then( res => {
    console.log(res)
})

official document Portal: https://www.kancloud.cn/yunye...

Menu