例如,您可以看到{{{body}}}
,在模板中,您可以执行{{data.page.hero.text}}
我们应该注意哪些重大差异?
答案 0 :(得分:8)
Handlebars HTML-escapes {{expression}}返回的值。如果您不希望Handlebars转义值,请使用" triple-stash",{{{。
答案 1 :(得分:0)
Depending on your use case and logic, you may add an option "noEscape" set to true when compiling the template if you want to use {{ }} when {{{ }}} are required to successfully replace the templates. For example: replacing with JSON values.
From the documentation:
var template = Handlebars.compile('{{foo}}', { noEscape: true });
noEscape: Set to true to not HTML escape any content.