I am facing an issue while using the component within itself in Nuxt.js. I'm getting the following error:
[Vue warn]: Unknown custom element: - Did you register the component correctly? For recursive components, make sure to provide the "name" option.
Here is how my code looks in components/MyComponent.vue
<template>
<div>
<h1>{{ a.content }}</h1>
<MyComponent :child="a.child" />
</div>
</template>
<script>
export default {
data() {
return {
a : {},
}
},
mounted() {
axios.get('/api/blah/')
.then((res) =>
{
this.a = res.data;
})
.catch((err) =>
{
console.error(err);
});
}
}
</script>
A similar piece of code worked fine with raw single-page HTML page using Vue.js, but I'm unsure about naming the component before using it here. How can I resolve this issue and make it work?