Мой код не работает. Я хочу напечатать свои задачи в списках, но пока не отображается ни один элемент списка. https://prnt.sc/pd6yx5 Я хочу отобразить вот так https://prnt.sc/pd6zoe Я хочу, чтобы компоненты были в концепции компонентов
HTML:
<div class="childcomponents-wrap">
<div class="container">
<div class="row">
<div class="col-md-12 col-sm-12 col-12">
<div id="childtasks">
<h2>Vue Components within Components</h2>
<task-list></task-list>
</div>
</div>
</div>
</div>
</div>
JS (Vue.js):
Vue.component('task-list', {
template:
'<div>
<task v-for="task in tasks">{{ task.task }}</task>
</div>',
data(){
return {
tasks: [
{task: 'Go to the United States', complete: true},
{task: 'Go to Kerala', complete: true},
{task: 'Go to Tamil Nadu', complete: false},
{task: 'Go to Simla', complete: true}
]
};
}
});
Vue.component('task', {
template: '<li><slot></slot></li>'
});
new Vue({
el: '#childtasks'
});