vue03-axios


安装

cnpm install axios --save
在main.js配置

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import axios from 'axios'


Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: ''
})


//axios支持promise,返回一个promise,调用内部的resolve
axios({
  url: 'http://123.207.32.32:8000/home/multidata',
	method: 'get' //默认是get方式
}).then(res=>{
  console.log(res)
})

vue