猿问

axios的delete方法怎么写

this.$ajax({
method:'delete',
url:'/api/commodityCategory/delete',
data:{
"id":"a"
},
})
.then(function(response){
console.log(response);
})
.catch(function(response){
console.log(response);
});
这样写好像毫无反应,也没有回报.看文档貌似也没有例子this.$ajax在vue的main.js配置过了
蓝山帝景
浏览 805回答 2
2回答

杨__羊羊

axios.delete({url:'/api/commodityCategory/delete',data:{"id":"a"}}).then(function(response){console.log(response);}).catch(function(response){console.log(response);});或者:axios({method:'delete',url:'/api/commodityCategory/delete',data:{"id":"a"}}).then(function(response){console.log(response);}).catch(function(response){console.log(response);});

森栏

axios说实话我没见过你所写的methods这个属性delete应该是axios的一个方法你应该axios.delete(url).then(res=>{})这种格式
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答