I\'m a beginner with Vue.js and I\'m trying to create an app that caters my daily tasks and I ran into Vue Components. So below is what I\'ve tried but unfortunately, it giv
I had the same error
[Vue warn]: Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option.
however, I totally forgot to run npm install && npm run dev to compiling the js files.
maybe this helps newbies like me.
Don't overuse Vue.component(), it registers components globally. You can create file, name it MyTask.vue, export there Vue object
https://vuejs.org/v2/guide/single-file-components.html
and then import in your main file, and don't forget to register it:
new Vue({
...
components: { myTask }
...
})
OK, this error may seem obvious, but one day I was looking for an answer JUST TO FOUND OUT THAT I HAD 2 times COMPONENTS declared. it was driving me nuts as VueJS does not complain at all when you declare it 2 times, obvious I had a lot of code in between, and when I added a new component, I placed the declaration in the top, while I also had one close to the bottom. So next time looks for this first, saves a lot of time