Usage of indexes in the loop-by Yang Yuan-about sequence number name gender age of the index in the loop
Serial number indicates the index of the current loop during the loop process. To put it bluntly, it indicates the number of loops currently, generally starting from 0, as is the case in Handlebars. js.
What is the purpose? The most common is to add a sequence number to each row when displaying a table, which clearly shows the total number of records on the page, as shown in the preceding example.
In addition, to differentiate different IDs in a loop, a sequence number is exactly required to ensure that IDs are not repeated. We should know that many events can be identified by IDs, for example, the Listgroup control.
In Handlebars. js, you can use {@ index} to obtain the current index. That is to say, the @ index variable represents the current index.
In the above example, the table sequence number is not good from 0, so a Helper is registered and the index is + 1.