최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday

티스토리 뷰

■ 백엔드 ■/NodeJS

vue-axios

serpiko 2018. 5. 9. 18:29



vue-axios

A small wrapper for integrating axios to Vuejs

How to install:

CommonJS:

npm install --save axios vue-axios

And in your entry file:

import Vue from 'vue'
import axios from 'axios'
import VueAxios from 'vue-axios'

Vue.use(VueAxios, axios)

Script:

Just add 3 scripts in order: vueaxios and vue-axios to your document.

Usage:

This wrapper bind axios to Vue or this if you're using single file component.

You can axios like this:

Vue.axios.get(api).then((response) => {
  console.log(response.data)
})

this.axios.get(api).then((response) => {
  console.log(response.data)
})

this.$http.get(api).then((response) => {
  console.log(response.data)
})



https://www.npmjs.com/package/vue-axios

'■ 백엔드 ■ > NodeJS' 카테고리의 다른 글

minifier - minifying CSS/JS  (0) 2018.05.14
--save와 --save-dev 차이  (0) 2018.05.14
vue-lodash  (0) 2018.05.09
node-sass  (0) 2018.05.09
concat  (0) 2018.05.09
댓글