如何在js模板引擎中输出对象的参数名称(小胡子,下划线)
我们有一些对象数组:
data = [
{
'showname-array': [
{'a':..}
{'b':..}
{'c':..}
]
},
{
'andanotherName-array': [
{'a':..}
{'b':..}
{'c':..}
]
},
]
是否可以使用 Mustache 或 underscore.js-templates 渲染对象属性的名称: '显示名称数组' 'andanotherName-array'
<div> Hello , showing content of: <% showname-array %> </div>
怎么可能?
We have some array of objects:
data = [
{
'showname-array': [
{'a':..}
{'b':..}
{'c':..}
]
},
{
'andanotherName-array': [
{'a':..}
{'b':..}
{'c':..}
]
},
]
Is it possible to render with mustache or underscore.js-templates the name of object's property:
'showname-array'
'andanotherName-array'
<div> Hello , showing content of: <% showname-array %> </div>
How is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用下划线
_.keys()
函数You can use Underscore
_.keys()
function