html - 如何在 Mithril 中将字符串转换为 HTML 元素?

标签 html string mithril.js

假设我有一个字符串 <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/

相关文章:

php - 检查我的网站时,源代码中缺少 wp-content 文件

html - 在 Bootstrap 4 Alpha 6 中对齐表单?

javascript - Mithril.js 具有多个 GET 请求

javascript - 提高 Angular 性能: change the view to reactjs or Mithril?

javascript - 子 visibility 影响父 visibility

javascript - 在 jquery 中添加图像

java - 断言语句后出现 ArrayIndexOutOfBoundsException

java - 将 System.out.println 或 stdout 数据捕获到 swing 备忘录(大数据)

java - 为什么在 Java 中 "!sort.getTestIssue().equals("Y")"不从 nasdaqlisted.txt 中删除测试股票?

javascript - mithril hello world MVC 示例不起作用