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

200
Views
VueJs3 v-si problema

tengo un problema de v-if, tengo este boton que me hace abrir un modal y que ejecuta una funcion addClick

 <button type="button" class="btn btn-primary m-2 fload-end" data-bs-toggle="modal" data-bs-target="#exampleModal" @click="addClick">

En el código modal, uso un if para mostrar crear o actualizar según la variable DepartmentIDjs

 <button type="button" @click="createClick()" v-if="DepartmentIdJs ==0" class="btn btn-primary"> Create </button> <button type="button" @click="updateClick()" v-if="DepartmentIdJs !=0" class="btn btn-primary"> Update </button>

Código JS

 let DepartementIdJs = ref(''); const addClick = () => { modalTitle = 'Add Departement', DepartementIdJs.value = 0; DepartementNameJs.value = ""; console.log(DepartementIdJs.value) } return { listDepartements, DepartementNameJs, DepartementIdJs, addClick, editClick, createClick, updateClick }

el archivo console.log me da 0 mientras que el modal me muestra el botón Actualizar ¿Puede alguien explicarme dónde cometí el error?

about 4 years ago · Juan Pablo Isaza
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!