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

150
Views
Alternar la variable v-if dentro del método de ciclo de vida created() en el marco VUE 3

Tengo un componente, donde hay 3 botones. 2 son visibles inicialmente

 <template> <button v-show="!showLogout" @click="login('google', 'profile, email')"> Google </button> <button v-show="!showLogout" @click="login('facebook', 'email')"> Facebook </button> <button v-show="showLogout" @click="logout()"> Log out </button> </template>.

Entonces tengo una variable de datos dentro de data()

 data() { return { showLogout: false }

En la configuración, introduzco HelloJS y en created () agrego un oyente donde alterno la variable

 setup() { return { hello } }, created() { hello.on('auth.login', function(auth) { this.showLogout = true }) }

Pero no vuelve a mostrar los botones (oculta google y facebook y muestra el cierre de sesión).

¿Cómo hacer que funcione así?

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

0

Simplemente use el gancho de configuración para definir sus propiedades de datos como:

 import {ref} from "vue" ... setup() { const showLogout= ref(false) hello.on('auth.login', function(auth) { showLogout.value = true }) return { showLogout} },
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!