[Vuejs]-Vuejs 3 composition api getCurrentInstance($refs)

0๐Ÿ‘

โœ…

As getCurrentInstance should normally not been used, you should follow the Template Refs guide.

<!โ€”- inside the template โ€”->
<my-modal ref="modalLoading" />
// your component
export default defineComponent({
  setup() {
    const modalLoading = ref(null);

    const handleSubmit = () => {
      If(!modalLoading.value) return;
      modalLoading.value.openModal();
    }

    return { modalLoading };

  }
})

Leave a comment