【发布时间】:2018-10-03 04:11:31
【问题描述】:
我有一个嵌套对象,所有索引都是时间戳,它包含有关时间戳日期和当天事件的信息
data : {
1522620000: {
events: {
1522620940: {title: event1},
1522620970: {title: event2},
}
},
1522706400:
events: {
1522620940: {title: event4},
1522620970: {title: event6},
}
},
1523311200: {
events: {}
},
...
}
如何在不循环访问数组的情况下访问星期五的所有事件?
我只有时间戳1522706400 表示为变量timestamp,我想像data[timestamp].events 一样访问它
目前我有
{{#each day}} //<-- another variable from a calendar.. don't care about it
{{# each data[timestamp].events }} //<-- the day contains information about the timestamp but does not contain the events..
{{ title }}
{{/each}}
{{/each}}
我通常使用 AngularJS 来完成类似的事情,但我有一个客户希望我使用车把,我对此感到非常困惑。
【问题讨论】: