前言
Vue要完成Ajax請求可以使用Axios套件。
首先要先安裝Axios套件
npm install axios
CheatSheet
axios.post('/apiUrl', {
parameter_1: 'Hello',
parameter_2: 'World'
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.log(error);
})
.finally(() => {
/*程式最後執行*/
});