Have a problem with registering component locally in Vue.js app. I'm trying to use MovieCard.vue inside it's parent MainView.vue. Made everythig as in the Vue docs, but still getting this error:
[Vue warn]: Unknown custom element: <movie-card> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
found in
---> <MainView> at src\components\MainView.vue
<VApp>
<App> at src\App.vue
<Root>
Here goes the code for MovieCard.vue(child component)
<template>
<div>
<!-- <v-card class="movie-card" height="30vh" hover>
<v-card-media :src="'http://image.tmdb.org/t/p/w500' + movie-info.poster_path" height="100%">
<v-card class="movie-card__info-cover" width="100%" height="100%">
{{this.movie-info}}
</v-card>
</v-card-media>
</v-card> -->
</div>
</template>
<script>
export default {
name: "MovieCard",
props: ["movie-info"],
data() {
return {
visible: false
}
},
created() {
console.log("Info:", this["movie-info"])
}
}
</script>
<style>
</style>
And for MainView.vue(parent component):
<template>
<v-container class="main-view" column>
<v-btn color="pink" dark small absolute bottom left fab></v-btn>
<v-tabs centered grow color="pink" slot="extension" slider-color="yellow">
<v-tab class="main-view__option" @click="setCategory('popular')">
Popular
</v-tab>
<v-tab class="main-view__option" @click="setCategory('upcoming')">
Upcoming
</v-tab>
<v-tab class="main-view__option" @click="setCategory('topRated')">
Top Rated
</v-tab>
</v-tabs>
<v-container class="movie-cards__container" fluid grid-list-xl>
<v-layout row wrap>
<v-flex xs3 md2 class="" v-for="n in this.movies.movieLists.list" :key="n.id">
<movie-card :movie-info="n"></movie-card>
</v-flex>
<infinite-loading @infinite="infiniteHandler" spinner="spiral"></infinite-loading>
</v-layout>
</v-container>
</v-container>
</template>
<script>
import { mapState, mapActions, mapMutations } from 'vuex';
import InfiniteLoading from 'vue-infinite-loading';
import MovieCard from "./MovieCard"
console.log(MovieCard)
export default {
name: 'MainView',
components: {MovieCard},
data () {
return {
chosenCategory: 'popular'
}
},
computed: {
...mapState([
'movies'
])
},
methods: {
...mapActions([
"getNextPageByCategory",
'setCategory'
]),
async infiniteHandler($state) {
await this.getNextPageByCategory(this.chosenCategory);
$state.loaded();
console.log("yay");
},
...mapMutations([])
},
components: {
InfiniteLoading
}
}
</script>
Also, I've noticed the fact that if i put the same component into my App.vue root component, it works as intended(like any other subcomponents, which are registered locally inside App.vue(for example MainView.vue)).
In addition, I'll say that i'm using Vuex and Vuetify inside my app.
Tried to solve this issue for hours, but for now no results...
Thank you in advance for your help!