Template.renderItem方法 [英] Template.renderItem method

查看:208
本文介绍了Template.renderItem方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。

阅读文档之后,我还不清楚何时应该使用此方法而不是渲染。任何想法?

After reading the docs, I'm still not clear on when I should this method instead of render. Any ideas?

谢谢

Luis Abreu

Luis Abreu

推荐答案

我看了一下docs和binding.js。

I took a look at the docs and binding.js.

这些来自文档几乎可以总结一下:

This from the docs pretty much sums it up:

呈现此模板的实例绑定到item中包含的数据。如果存在
回收参数,并且enableRecycling为true,则模板会尝试重用循环参数中的DOM元素。

Renders an instance of this template bound to the data contained in item. If the recycled parameter is present, and enableRecycling is true, then the template attempts to reuse the DOM elements from the recycled parameter.

什么是真正令人困惑的是,最后一个参数不是布尔值,因为它已被记录,但应该是先前生成的与模板匹配的DOM元素。 我找不到任何使用它的样本,但我想象它可能有用,如果你
正在改变你在模板中显示的数据(并且它没有多次出现)你可以传递你创建的DOM元素第一次渲染模板时。

What is really confusing is that the last parameter is NOT a boolean as it is documented but should be a previously generated DOM Element that matches the template.  I could not find any sample that uses this but how I imagine it may work is if you are changing the data you were displaying in the template (and it was not occuring multiple times) you could pass the DOM Element you created the first time you rendered the template.

类型: DOM元素

以前生成的模板实例。


这篇关于Template.renderItem方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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