4π
β
By wrapping defineAsyncComponent()
in a function, youβre incorrectly declaring the Modal
component as a function:
export default {
components: {
/* π don't do this */
Modal: () => defineAsyncComponent(() => import('@/components/Modal.vue'))
},
}
The simplest solution is to remove the function wrapper:
export default {
components: {
Modal: defineAsyncComponent(() => import('@/components/Modal.vue'))
},
}
π€tony19
1π
Looks like youβre mixing composition and options API
Try the following in the <script>
import { defineAsyncComponent, ref } from 'vue';
export default {
setup() {
const Modal = defineAsyncComponent(() => import('@/components/Modal.vue'));
const showModal = ref(false);
return {
showModal,
Modal
}
}
}
π€Jaromanda X
Source:stackexchange.com