本文介绍了Mustache.render()和Mustache.to_html()之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

未提及Mustache.to_html(),但每个,适用于Mustache.js在线使用Mustache.to_html( )。所以我肯定错过了一些珠宝。

The documentation makes no mention of Mustache.to_html(), but every tutorial for Mustache.js online uses Mustache.to_html(). Therefore I am surely missing some jewels.

非常感谢代码示例。

推荐答案

查看,似乎 to_html 基本上已被弃用:

Looking at the source, it seems to_html has essentially been deprecated:

// This is here for backwards compatibility with 0.4.x.
exports.to_html = function (template, view, partials, send) {
    var result = render(template, view, partials);

    if (typeof send === "function") {
      send(result);
    } else {
      return result;
    }
};

如你所见,它会调用 render 。一个区别是额外的(可选的)发送参数,它是一个它调用的回调(将结果作为参数发送)。

As you can see it invokes render. The one difference is the extra (optional) send parameter, which is a callback it invokes (sending the result as a parameter).

这篇关于Mustache.render()和Mustache.to_html()之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 08:53