在Axios的请求中添加responseType:'document'选项,以确保返回XML格式的数据。示例如下:
axios.get(url,{ responseType:'document' // 添加选项,指定返回数据类型为XML格式 }) .then(response => { console.log(response.data); // 打印XML数据 }) .catch(error => { console.error(error); });
上一篇:Axios返回对象但useState钩子无法设置
下一篇:Axios返回二进制数据而不是XML数据