使用axios寫API的時候佩耳,發(fā)現(xiàn)delete請求一直有問題螃宙,最后發(fā)現(xiàn)delete跟post挂捅、patch等方法接收的第二個參數(shù)不一樣闲先。post酱讶、patch接收的第二個參數(shù)直接為需要傳輸?shù)臄?shù)據(jù)泻肯,而delete接收的第二個參數(shù)為config。
axios.request(config)
axios.get(url[, config])
axios.delete(url[, config])
axios.head(url[, config])
axios.post(url[, data[, config]])
axios.put(url[, data[, config]])
axios.patch(url[, data[, config]])
則delete需要通過config來傳遞數(shù)據(jù)
axios.delete(url, {data: MyData})