有没有一种方法来获取车把模板内的数组的索引,我想获取数组中的最后一个值并调用a。财产
{{currentRevision.computedRoutingNodes.length-1.numberOfReviewDays}}
computeRoutingNodes是对象数组
我知道我可以得到像
{{currentRevision.computedRoutingNodes.1.numberOfReviewDays}}
但我想动态获取最后一个值
最佳答案
如果您使用的是Ember.js,则{{currentRevision.computedRoutingNodes.lastObject.numberOfReviewDays}}
将起作用。
关于javascript - Handlebars 阵列长度-1,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26679004/