I want to progressively switch from Backbone + Handlebars to Vue, but I am having some troubles with Handlebars templates.
In one of my templates I have something like this:
{{#each tHeads}}
{{#if @last}}
{{#each th}}
{{#if iWidth}}
<col style="width: {{iWidth}}px;"/>
{{/if}}
{{/each}}
{{/if}}
{{/each}}
I want to translate this to a vue template, but cannot find the corresponding for @last helper from Handlebars.
There is no implementation for something like
@last
in Vue, as Evan You explained here that it will be costly to have such feature which are also used not that frequently for eachv-for
loop.You can define a method
isLast
for this and use it like following:JS