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 > 2, where as the usage of { { {variable} } } will result in 5 > 2.
我覺得你要看下文檔才行。(上面為 https://github.com/janl/mustache.js 中摘抄)
簡單來說 {{{}}} 可以滿足你的要求
- 1 回答
- 0 關注
- 433 瀏覽
相關問題推薦
添加回答
舉報
0/150
提交
取消
