循环内的防暴标签

我有一个xxx组件,当它与riot-tag属性和一个标准的HTML5标签一起使用时,它可以正常工作: <article riot-tag="xxx"></article> 。 但是,当我在循环中使用riot-tag属性时,标签是空的: <article each="{xxxTags}" riot-tag="{xxx}"></article> 。 在一个循环中是否可以使用riot-tag ? 我怎样才能使它工作?


附加说明:

我必须逐个生成几个不同的,尽pipe相似的组件。 所以我有一个数组来存储它们:

 var xxxTags = [{tag: 'xxx'}, {tag: 'yyy'}, {tag: 'zzz'}]; 

xxxyyyzzz中的任何一个textareas都手动一个接一个地手工运行,并生成相应的组件。 但是,当我试图做到这一点,他们最终在铬devtools空(没有孩子),但其他手动放置相同。

 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>JS Bin</title> </head> <body> <my-tag></my-tag> <!-- inlined tag definition --> <script type="riot/tag"> <my-tag> /*Standard, manual addition of different components (works)*/ <xxx></xxx> <yyy></yyy> <zzz></zzz> /*Standard addition of same components in a loop (works)*/ <div each={myTags}>{tag}</div> <br> /*Addition of different components with "riot-tag" manually (works)*/ <div riot-tag="xxx"></div> <div riot-tag="yyy"></div> <div riot-tag="zzz"></div> /*Addition of different components with "riot-tag" in a loop (DOESN'T WORK should look like the example above)*/ <div each={myTags} riot-tag="{tag}"></div> this.myTags = [{tag: 'xxx'}, {tag: 'yyy'}, {tag: 'zzz'}]; </my-tag> <xxx> <p>X content</p> </xxx> <yyy> <p>Y content</p> </yyy> <zzz> <p>Z content</p> </zzz> </script> <!-- include riot.js and the compiler --> <script src="//cdn.jsdelivr.net/g/riot@2.2(riot.min.js+compiler.min.js)"></script> <!-- mount normally --> <script> riot.mount('*'); </script> </body> </html> 

好的,看起来像带有riot-tag属性riot-tag每个循环生成时都不会被装载 (看起来像是一个bug)。 对于上述代码,添加这个工作:

 this.on('mount', function() { for(var i = 0; i < this.myTags.length; i++) riot.mount(this.myTags[i].tag); });