自己使用下来,感觉post,put 差不多
axios.post('http://127.0.0.1:8080/test/login', {
name: "admin",
pwd: "123456"
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
axios.put('demo/url', {
id: 123,
name: 'Henry',
},{
timeout: 1000,
...//其他相关配置
}).then()
get
axios.get('http://127.0.0.1:8080/test/delUser',{
params: {
userId: id,
}
}).then((response) => {
console.log(response.data);//请求的返回体
}).catch((error) => {
console.log(error);//异常
});