data: { sending: false }, methods: { form_submit (event) { this.sending = true axios.get(url, data) .then(res => { this.sending = false console.log(res.status, res.statusText, res.data) // => 200, "OK", { message: "You just sent the data!" } }) .catch(error => { this.sending = false throw error }) } } もっとVueに繋げる vue-resourceはVueと密に繋がって、 this.$http.get() みたいな感じで使うそうだ。 axiosは完全に独立しているけれど、 this から参照で
![VueでAjaxやるときはaxiosがおすすめなんだって。(Vue.js始めるおれおれアドベントカレンダー2016 – 14日目) | Ginpen.com](https://cdn-ak-scissors.b.st-hatena.com/image/square/de4af7f62b39439905833504e59ba1e153be6d8b/height=288;version=1;width=512/https%3A%2F%2Fginpen.com%2Fwp-content%2Fthemes%2Fginpen-theme%2Fimg%2Ficon-512.png)