新建
This commit is contained in:
25
public/assets/libs/art-template/demo/no-escape.html
Normal file
25
public/assets/libs/art-template/demo/no-escape.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>no escape-demo</title>
|
||||
<script src="../dist/template.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>不转义HTML</h1>
|
||||
<div id="content"></div>
|
||||
<script id="test" type="text/html">
|
||||
<p>不转义:{{#value}}</p>
|
||||
<p>默认转义: {{value}}</p>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var data = {
|
||||
value: '<span style="color:#F00">hello world!</span>'
|
||||
};
|
||||
var html = template('test', data);
|
||||
document.getElementById('content').innerHTML = html;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user