可以尝试在请求时添加一些配置,如headers、params等。具体示例:
axios.patch(url, data, {
headers: { 'Content-Type': 'application/json' },
params: { id: '123' },
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.log(error);
});
其中,headers配置指定了请求类型为json;params配置指定了请求的参数id为123。