我正在尝试显示活动议程上的项目列表。
活动start_date结束 议程上的每个项目都有一个duration以分钟为单位的时间,例如:
event:{
start_date: '2017-03-01 14:00:00',
agendas:[
{id:1,duration:10},
{id:2,duration:15},
{id:3,duration:25},
{id:4,duration:10}
]
}
现在,在我的event组件中,我加载agendas了一个v-for:
<agenda v-for="(agenda,index) in event.agendas"
:key="agenda.id"
:index="index"
:agenda="agenda">
在agenda组件中,我想增加每个项目开始的时间:
<div class="agenda">
//adding minutes to start_date with momentJs library
{{ moment(event.start_date).add(agenda.duration,'m') }} //this should increment, not add to the fixed event start date
</div>
目前它只添加到固定事件start_date...我想显示14:00事件1、14:10事件2、14:25事件3和14:50事件的时间4。
如何v-for在 Vue.js 2.0 中增加指令中的值?