JSPM

  • Created
  • Published
  • Downloads 5549
  • Score
    100M100P100Q116953F
  • License ISC

a http client for Vue.js based on axios

Package Exports

  • vue-request

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vue-request) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

vue-request

install

npm i vue-request

usage

//almost same as axios
this.$http.get('/posts/:id', { urlParams: { id: 1 } }).then(res => console.log(res.data))
this.$http.delete('/posts/:id', { urlParams: { id: 1 } }).then(res => console.log(res.data))
this.$http.post('/posts', { userId: '123' }).then(res => console.log(res.data))
this.$http.get('/posts/:id(\\d+)', { urlParams: { id: 'ddd' } }).then(res => console.log(res.data)) //type error : Expected "id" to match "\d+", but received "ddd"
this.$http.get('/posts', { params: { userId: 1 } }).then(res => console.log(res.data)) //query String
this.$http.post('/posts', { userId: 'xiadd' }, { headers: { 'Content-Type': 'multipart/form-data' } }).then(res => console.log(res.data))