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

209
Views
vue3 It seems that the setup function returns before the onMount function
createApp({
    setup() {
        let price = 0
    
        onMounted() {
            // axios
            price = axios.response
        }
        return { price }
    }
}).mount('#app')

HTML

<h6 id="app" class="mb-0">{{price}}</h6>

The current situation is that a value of 0 is continuously output. Looking at the order, it seems that the setup function returns before the onMounted function and has already done the rendering.

What should I do?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You should use price = ref(0) for reactivity.

https://vuejs.org/api/composition-api-setup.html#basic-usage

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!