I hope you are all well. I'm currently having some issues with using a component that is inside a parent component. I tried a few things but without success... The component ModalBoxActionArticle doesn't want to show and I have the following error message :
[Vue warn]: Failed to resolve component: ModalBoxActionArticle at at <Home onVnodeUnmounted=fn ref=Ref< undefined > > at at
Could you please help me with this? Thanks in advance for your time and help.
Find below the vue View that is at the root of these components:
<template>
<div class="home">
<ImageArticle class="home__component"/>
</div>
</template>
<script>
import ImageArticle from "../components/imageArticle"
export default {
name: 'Home',
components: {
ImageArticle,
}
}
</script>
Find below the ImageArticle component (I removed the style)
<template>
<div>
<article class="postWithImage">
<ModalBoxActionArticle/>
<div class="postWithImage__1div">
<picture class="postWithImage__pictureProfile">
<img class="postWithImage__imgProfile" src="../assets/EugenieProfile.jpeg" alt="photo de profile de la personne qui a publié l'image">
</picture>
.... here I removed some html to make it more readable ....
</article>
</div>
</template>
<script>
import ModalBoxActionArticle from '../components/modalBoxActionArticle'
export default {
name: 'ImageArticle',
component : {
ModalBoxActionArticle
},
setup() {
console.log('%c loading ImageArticle component', 'color:green');
return {};
},
}
</script>
Last but not least find below, the component ModalBoxActionArticle that is inside the ImageArticle component
<template>
<div class="modal">
<button class="modal__btt modal__btt--alert">Signaler</button>
<button class="modal__btt">Partager</button>
<button class="modal__btt">Modifier</button>
<button class="modal__btt modal__btt--alert">Supprimer</button>
</div>
</template>
<script>
export default {
name: "ModalBoxActionArticle",
setup() {
console.log('%cloading ModalBoxActionArticle newest component', 'color:red');
return {};
},
}
</script>
In ImageArticle.vue you have defined
component : {
ModalBoxActionArticle
},
This must be like (the letter s must be at the end of the word component):
components : {
ModalBoxActionArticle
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With