如何在handlebar.js中表示整数数组 [英] How to represent Array of integers in handlebar.js

查看:103
本文介绍了如何在handlebar.js中表示整数数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个json对象"FoundAt":[1,3] 如何使用handlebar.js表示数组中的值?

I have a json object "FoundAt" : [1, 3] How do I represent the values in the array using handlebar.js?

推荐答案

如果要引用数组的迭代,则可以使用{{each}}块进行迭代,并参考上面定义的数组,请使用以下代码:

If you are referring to iterating the array you can do so using {{each}} block, with reference to the above defined array use the following:

 {{#each jsonObjectName.FoundAt}}
  {{this}}
 {{/each}}

OR

 {{#each number in jsonObjectName.FoundAt}}
  {{number}}
 {{/each}}

在官方文档中寻找简单迭代器

这篇关于如何在handlebar.js中表示整数数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆