vue-cli3 使用 axios
2019-10-14 本文已影响0人
WXL_JIANSHU
一、添加依赖
vue add axios
二、引入
main.js
import axios from "axios";
Vue.prototype.$axios = axios;
三、GET示例

四、POST示例
this.$axios.post('/api/news/matches', {
page: 1,
limit: 10,
})
.then((response) => {
console.log(response);
})
.catch((error) =>{
console.log(error);
});
五、解决跨域
