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

251
Views
vuejs @click.once is not call matched methods

If the ID of the registered item exists on the page, get the information of the registered item and then edit @click.once(update) If the registered item does not exist, we try to register @click.once(create). The condition of the method is to render the button element with v-if condition. Execution of the methods was performed with @click.once to prevent duplicate execution.

After loading the data in mounted, itemId clearly exists, but only create methods are being executed. Is there something I am missing?

<button v-if="itemId !== null" @click.self.prevent="update" :disabled="!validRegister">modify</button>
<button v-else @click.self.prevent="create" :disabled="!validRegister">save</button>


<script>
  async asyncData({ $axios, store }) {
     const response = await actions.get.partnerInfo({$axios, params})
     return {
        bannerInfo = response ? response.id : null
     }
  },
  data(){ 
    return {
      itemId: null,
    } 
  },
  async mounted() {
    if(this.bannerInfo.id){
        this.itemId = this.bannerInfo.id ? this.bannerInfo.id : null;
  }

</script>
about 4 years ago · Santiago Trujillo
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!