artTemplate template engine, the data obtained from the background is html code, whether it is rendered to the page or label, how to solve it
仅有的幸福2017-07-05 11:05:48
You can use jQuery to replace tags
<script>
var data="<font color='red'>测试数据</font>";//带有html标签的测试数据
$('#p1').html(data);//通过html()方法将数据输出到p中
</script>
You try it! Dude, don’t forget to introduce jQuery
Of course, native js is also possible
天蓬老师2017-07-05 11:05:48
It’s very simple, you create a new DOM node <p id="content"></p>, then var a variable equal to this code, assign this variable to the DOM node, use jQuery method As mentioned above, the native method is
<script>
var str = "那段代码";
document.getElementById("content").innerHTML(str);
</script>
巴扎黑2017-07-05 11:05:48
// [3]. Use templates to generate HTML. The output is escaped by default. If not escaped, use {{#value}}
欧阳克2017-07-05 11:05:48
I happened to encounter this problem when I was using artTemplate recently.
Use {{@html}}
for original text output
There are risks, use with caution.
Official tutorial: https://aui.github.io/art-tem...Original text output