Importing Axios

  • Hi,

    I’m not sure how to import Axios into my Quasar project. I’ve installed Axios through npm, but I can’t get it to import into my project. Which file should I be including it in and what should the line that imports it look like?


  • You should put it in your main.js file:

    import Vue from 'vue'
    import Quasar from 'quasar'
    import router from './router'
    import axios from 'axios'
    import VueAxios from 'vue-axios'
    Vue.use(VueAxios, axios)
    Vue.use(Quasar) // Install Quasar Framework
    Quasar.start(() => {
    	/* eslint-disable no-new */
    	new Vue({
                    el: '#search-app',
    		render: h => h(require('./App'))

  • if you just use axios, in any module you define

    import axios from 'axios'
    export default {
      methods: {
        getItems() {
           .then(res => {
           .catch( res => {  console.log('error', res) })

  • @dgarcia & @boriscy Thank you very much for the help. It worked perfectly.

Log in to reply

Looks like your connection to Quasar Framework was lost, please wait while we try to reconnect.