axios發送請求

1.安裝axios

npm install --save axios vue-axios

2.在項目中引用

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

3.在項目中使用

Vue.use(VueAxios,axios)
this.axios({
        method:"GEt",
        url:"http://localhost:3000/json/myjson.json"
      }).then(function(response){
        vm.list = response.data.products;
      })

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章