Ajax Requests
Quasar recommends using Axios
or Vue-Resource
.
These packages are not provided by default so you will have to npm install them and import from src/main.js
.
Quickstart with axios
Installation: npm install axios --save
First make the package globally available within Vue(main.js):import axios from 'axios';
Vue.prototype.$http = axios
Then to use the package in your components:// Make a get request
this.$http.get('/user')
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
- Get started with axios
- Get started with vue-resource
- Vue Cookbook topic vuejs-cookbook
- Using libraries from npm with vue: vuejsdevelopers.com