gpt4 book ai didi

javascript - Mustache.render() 和 Mustache.to_html() 有什么区别?

转载 作者:行者123 更新时间:2023-12-03 02:47:24 25 4
gpt4 key购买 nike

documentation没有提到 Mustache.to_html(),但每个 tutorial Mustache.js 在线使用 Mustache.to_html()。因此我肯定缺少一些珠宝。

代码示例将非常感激。

最佳答案

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

// 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;
}
};

正如您所看到的,它调用了渲染。唯一的区别是额外的(可选)send 参数,它是它调用的回调(将结果作为参数发送)。

关于javascript - Mustache.render() 和 Mustache.to_html() 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10872615/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com