[Vuejs]-Component isn't display by VueJS if it is inside a v-if/v-show

1👍

When using ref, you need to add variables ref with the same names.

const patientNotOk = ref();
const patientOk = ref();

Here is a working script setup :

<script setup>
import { ref } from "vue";
const patientNotOk = ref();
const patientOk = ref();
const showPatientForm = () => {
  try {
    const createPatient = patientNotOk.value; // Find the <div> of the form
    createPatient.classList.remove("hidden"); // Get rid of the hidden class
  } catch (err) {
    console.error(err);
  }
};
</script>

Leave a comment