Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
问题
模板编译失败:
'<tr><td>No Heartbeat {{:name}} : {{:Heartbeat>30d}}</td></tr>'
请参阅 JS Fiddle:问题示例
JSON 源
{ "name": "Desktops", "Heartbeat>30d": 3004 }
通缉
转义 JSRender 表达式:{{:Heartbeat>30d}} 以引用 JSON 字段并正确编译。
您可以使用#data["name of the property"]来访问某些属性。因此,您的模板应如下所示:
#data["name of the property"]
'<tr><td>No Heartbeat {{:name}} : {{:#data["Heartbeat>30d"]}}</td></tr>'
我已经更新了您提供的 jsfiddle 示例:
http://jsfiddle.net/h65KX/11/