我是Ractivejs的新手,我正在尝试实现简单的部分递归...
我的模板是
List:<br>
<ul>
{{#list}}
{{>lipart}}
{{/list}}
</ul>
<!-- {{>lipart}} -->
<li>{{text}} {{#children}} <ul> {{>lipart}} </ul> {{/children}}
<!-- {{/lipart}} -->
和我的数据:
list: [
{text:'item1'},
{text:'item2', children : [{text:'item2a'},{text:'item2b'}] },
{text:'item3'}
]
这导致&#34;超出最大调用堆栈大小&#34;错误。 我究竟做错了什么?
答案 0 :(得分:4)
我刚刚找到了自己问题的答案。这里的问题在http://docs.ractivejs.org/latest/mustaches#restricted-references
中有所描述要解决上述无限循环,我必须改变
{{#children}} ... {{/children}}
到
{{#.children}} ... {{/.children}}