Recently, I decided to dive into Vue.js as a beginner and started working on an app to manage my daily tasks. However, I encountered Vue Components along the way and ran into an error that has me puzzled:
vue.js:1023 [Vue warn]: Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option.
If anyone has any insights or tips, please share them with me!
new Vue({
el : '#app',
data : {
tasks : [
{ name : "task 1", completed : false},
{ name : "task 2", completed : false},
{ name : "task 3", completed : true}
]
},
methods : {
},
computed : {
},
ready : function(){
}
});
Vue.component('my-task',{
template : '#task-template',
data : function(){
return this.tasks
},
props : ['task']
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.26/vue.js"></script>
<div id="app">
<div v-for="task in tasks">
<my-task :task="task"></my-task>
</div>
</div>
<template id="task-template">
<h1>My tasks</h1>
<div class="">{{ task.name }}</div>
</template>