为了账号安全,请及时绑定邮箱和手机立即绑定

为什么结果都是html标签直接显示出来?怎么整?

为什么结果都是html标签直接显示出来?怎么整?

ITMISS 2023-04-05 21:17:52
ajax返回json数据中包括html标签,使用mustache插入到模块中,结果都是html标签直接显示出来。试过先将html转义,但没有作用。求解决方法。
查看完整描述

1 回答

?
牛魔王的故事

TA贡献1830条经验 获得超3个赞

mustache.js does escape all values when using the standard double mustache syntax. Characters which will be escaped: & \ " < >. To disable escaping, simply use triple mustaches like { { {unescaped_variable} } }.

Example: Using { {variable} } inside a template for 5 > 2 will result in 5 &gt; 2, where as the usage of { { {variable} } } will result in 5 > 2.

我觉得你要看下文档才行。(上面为 https://github.com/janl/mustache.js 中摘抄)

简单来说 {{{}}} 可以满足你的要求


查看完整回答
反对 回复 2023-04-07
  • 1 回答
  • 0 关注
  • 207 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信