use Tencent Map in vue,
use axios to make ajax requests when requesting data
for example:
request route planning
set
"/searchwalk":{
target:"https://apis.map.qq.com/ws/direction/v1/walking/?",
changeOrigin:true,
pathRewrite:{
"^/searchwalk":"/searchwalk"
}
},
and then in the vue page, you will use
.axios({
method:"get",
url: "/searchwalk",
params: {
from: "39.984042,116.307535",
to:"39.976249,116.316569",
key:"WQCBZ-4FF3F-WI4JL-NJGAX-MECTJ-GMFWA"
},
headers:{
"X-Requested-With":"XMLHttpRequest",
"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"
}
}).then(res => {
console.log(res);
})
my understanding is that the request url is like this
https://apis.map.qq.com/ws/direction/v1/walking/?from=39.984042,116.307535&to=39.976249,116.316569&key=WQCBZ-4FF3F-WI4JL-NJGAX-MECTJ-GMFWA
but the message returned after the request is
{status: 300, message: "from"}
how can I correctly use axios to add parameters?