1.下载art-template模板引擎库文件:https://aui.github.io/art-template/zh-cn/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>art-template使用步骤</title>
//2.导入art-template模板库文件
<script src="/js/template-web.js"></script>
</head>
<body>
//3.准备art-template模板
<script id="tpl" type="text/html">
<h1>{{username}} {{age}}</h1>
</script>
<script type="text/javascript">
// 4.配置模板与数据连接template('模板id',数据 对象类型),返回值是拼接好的html字符串
var html = template('tpl', {
username: '张三',
age: 20
});
console.log(html);//<h1>张三 20</h1>
// 5.写入拼接好的html字符串
document.body.innerHTML = html;
</script>
</body>
</html>