javascript - artTemplate template engine, the data obtained from the background is how the html code is rendered to the page
大家讲道理
大家讲道理 2017-07-05 11:03:48
0
4
1423

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

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(4)
仅有的幸福

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

Peter_Zhu

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>

巴扎黑

// [3]. Use templates to generate HTML. The output is escaped by default. If not escaped, use {{#value}}

学霸

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template