Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

116
Views
Ability to load component while axios

Is it possible to do the following: There is a spinner component.

axios:

    method() {
     SPINNER (component) -- on
     axios.get('/shop', {
       params: {
         something
        }
      }) .then ((resp) => {
        SPINNER (component) -- off
      })
    }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use v-if:

Vue.component('spinner', {
  template: `
    <div class="">
      loading...
    </div>
  `
})

new Vue({
  el: '#demo',
  data() {
    return {
      loading: true
    }
  },
  methods: {
    loadData() {
    // this would be your axios call
      setTimeout(() => {
        console.log('finished loading!');
        // on success just change data property
        this.loading = false
      }, 2000);
    }
  },
  mounted() {
    this.loadData()
  }
})

Vue.config.productionTip = false
Vue.config.devtools = false
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="demo">
  <div v-if="!loading">loaded</div>
  <spinner v-if="loading" />
</div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!