Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

253
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda