Knockout renderTemplate()渲染模式 [英] Knockout renderTemplate() rendering modes

查看:378
本文介绍了Knockout renderTemplate()渲染模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在自定义绑定中调用 ko.renderTemplate()

I'm trying to call ko.renderTemplate() in a custom binding.

但是我可以找不到任何使用文档,特别是渲染模式参数。

However I can't find any documentation for it's usage, particularly the rendering mode parameter.

Knockout.js专业技巧 - 使用模板

该网站上面有一个部分您可以直接从自定义绑定中直接渲染模板,简要描述参数到 renderTemplate()

The site above has a section "You can render templates directly from your custom bindings" that briefly describes the parameters to renderTemplate().

渲染模式参数的其他可用选项是什么?

此外,是否有任何文档对于 renderTemplate()和我可能错过的渲染引擎选项?

Additionally, is there any documentation for renderTemplate() and the rendering engine options that I may have missed?

推荐答案

只是从2.2.0的源代码。

Just from looking at the source code of 2.2.0.

renderMode参数似乎有两个选项:

The renderMode parameter seems to have two options:


  • replaceNode - 这将用模板的输出替换整个目标节点。

  • replaceChildren - 默认。这将仅替换目标节点的子节点,使目标节点保持不变。

  • replaceNode - This will replace the entire target node with the output of the template.
  • replaceChildren - Default. This will replace only the children of the target node, leaving the target node intact.

这篇关于Knockout renderTemplate()渲染模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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