0
我有一个看起来像这样的组件:VUE定制发出不工作的V-的
<task-list :content="lesson.children" :iterator="lesson.section" :user="user" @updateTask="updateTask"></task-list>
我使用的组件在2个不同的网页。在页面上的插入,就像是,在另一页其父是V型的,所以它看起来像:
<div class="lesson-list-item" v-bind:class="{ 'lesson-complete': course.iterator_position > index}" v-for="(lesson, index) in content" >
<task-list :content="lesson.children" :iterator="lesson.section" :user="user" @updateTask="updateTask"></task-list>
</div>
两个页面有方法:
updateTask(index){
var self = this;
this.loaded = false;
this.iterator = index;
this.newTask = index;
setTimeout(function() { self.loaded = true }, 10);
}
这是任务列表发出一个点击:
cardClick(index, slug, initialIterator){
console.log(index);
if(index <= this.initialIterator){
this.$emit('updateTask', index);
}
}
那里它不是裹在v-for
作品的页面,这是从来没有收到信号发送的事件之一。
您可能要包括发出了'updateTask'事件的代码。并澄清你的意思是“不起作用”,或者包含指向展示该问题的jsFiddle的链接。 – PatrickSteele
@patricksteele我刚刚更新了问题 – Packy
@patricksteele感谢提及updateTask emit。它以一种可以在一页上触发但不是另一种触发的方式进行包装,因此它很有意义。我专注于错误的区域 – Packy