假设我有一个字符串 <span class="msg">Text goes here</span>
.我需要在我的网页中使用这个字符串作为 HTML 元素。关于如何做到这一点有什么想法吗?
最佳答案
Mithril 提供 m.trust
为此的方法。在 View 中需要 HTML 输出的位置,写入 m.trust( '<span class="msg">Text goes here</span>' )
你应该被分类。
关于html - 如何在 Mithril 中将字符串转换为 HTML 元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30435250/