【问题标题】:Mustache template escape html code小胡子模板转义html代码
【发布时间】:2015-09-29 06:10:48
【问题描述】:

我有这样的javascript数组,

[button: "M'AVERTIR"]

当我试图在 mustache 模板中显示字符串时。它显示以下格式。

M'AVERTIR

我的小胡子模板代码是,

{{=<% %>=}}
<%button%>
<%={{ }}=%>

有没有办法解决这个问题?

【问题讨论】:

  • 您可以尝试使用 {{{ }}}。他们将 html 呈现为 html。
  • 是的。我试过了。但是,像这样显示的文本只有 M'AVERTIR.
  • {{==}} 我试过这样。有用。感谢您的回复。

标签: javascript jquery mustache


【解决方案1】:

你可以试试这个:

* {{default_tags}}
{{=<% %>=}}
* <% erb_style_tags %>
<%={{ }}=%>
* {{ default_tags_again }}

See the page

【讨论】:

    【解决方案2】:

    我试过这样,

    {{=<% %>=}}
    <%& button %>
    <%={{ }}=%>
    

    它对我有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-14
      • 2012-04-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多