vue-h-ajax
Edge 12+, FF 36+, Chrome 49+, or use translation from ES2105 to ES5
Introduction
vue-h-ajax
is the small ajax module for Vue.js. It deeply integrates with Vue.js core to make building Single Page Applications with Vue.js a breeze. Features include:
- Lightweight: 3.5kb of sources
- No dependencies
- try to parse data as JSON by default
- withCredentials by default
- DELETE request with body
Setup
npm install vue-h-ajax
Example
;; Vue; Vuehttp ; Vuehttp; const app = template: '<div class="main"></div>' el: '#app' { this$http ; };
API
withCredentials
- type:
Boolean
. Defaulttrue
;; Vue; VuehttpwithCredentials = false;
headers
- type:
Object
Global headers for all requests
;; Vue; Vuehttpheaders = 'Content-Type': 'application/json';
get(url, data, headers), post(...), put(...), delete(...)
- returns
Promise<response>
. Response format:
stop(url)
Abort all current requests matched url
;; Vue; Vuehttp;Vuehttp;Vuehttp; Vuehttp;