炎炎設(shè)計
2019-03-03 15:43:02
this.$ajax({ method: 'delete', url: '/api/commodityCategory/delete', data: { "id":"a" }, }) .then(function(response) { console.log(response); }) .catch(function(response) { console.log(response); });這樣寫好像毫無反應(yīng),也沒有回報.看文檔貌似也沒有例子this.$ajax 在vue的main.js配置過了
2 回答

至尊寶的傳說
TA貢獻1789條經(jīng)驗 獲得超10個贊
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);
});

侃侃無極
TA貢獻2051條經(jīng)驗 獲得超10個贊
axios說實話我沒見過你所寫的methods這個屬性
delete應(yīng)該是axios的一個方法
你應(yīng)該axios.delete(url).then(res=>{}) 這種格式
添加回答
舉報
0/150
提交
取消