模板引擎概述
作用:使用模板引擎提供的模板语法,可以将数据和HTML拼接起来
使用步骤
- 下载art-template模板引擎库文件并将其引入到HTML页面中
下载安装地址:http://aui.github.io/art-template/docs/installation.html#Pre-compilation-in-browser
<script src="./js/template-web.js"></script>
- 准备art-template模板
为了在script内部方便的书写HTML语法,并且要有HTML的高亮提示,所以在script内部添加type="text/html"
<script type="text/html" id='tpl'>
<div id="box"></div