<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>简介语法</title>
</head>
<body>
<div id="box"></div>
<!--**注意** 模版当中没有其他全局变量 -->
<!--
<% for(var i = 0 ; i < model.length ; i ++){ %>
<%=model[i].name%>今年<%=model[i].age%><br>
<% }; %>
-->
<!--
{{ each model as value i }}
{{value.name}}今年{{value.age}}<br>
{{/each}}
-->
<script type="text/template" id="box_template">
{{ each model}}
{{$index}} {{$value.name}}今年{{$value.age}}<br>
{{/each}}
</script>
<!--原生语法的js native-->
<script src="js/template.js"></script>
<script src="js/jquery.min.js"></script>
<script>
/*1.准备数据*/
var dataList = [
{name:'xgg',age:'10'},
{name:'xgg',age:'12'},
{name:'xgg',age:'13'},
{name:'xgg',age:'14'},
{name:'xgg',age:'18'}
]
/*2.转化数据成html*/
var html = template('box_template',{model:dataList});
/*3.渲染*/
document.querySelector('#box').innerHTML = html;
</script>
</body>
</html>

最新文章

  1. 运用DebugDiag诊断ASP.Net异常
  2. Linux Bash 使用$?来防止一些误删操作
  3. linux各种命令
  4. Java 7 语法新特性
  5. SPRING IN ACTION 第4版笔记-第五章BUILDING SPRING WEB APPLICATIONS-007-表单验证@Valid、Error
  6. Eclipse选择rt.jar的源代码的位置
  7. 比较了一下基于PhoneGAP/JQ Mobile 等基于HTML5的Phone 开发框架
  8. Memcache缓存系统原理
  9. sharepoint 2013 个人网站公共母板页路径地址
  10. Java 领域从传统行业向互联网转型你必须知道的事儿
  11. 转://IO的基础概念
  12. property与x.setter与x.deleter
  13. C# 有哪些集合
  14. 【Python】利用正则解析xml练习题
  15. 【Android】录音-amr音频录制
  16. Android AES 加密、解密
  17. Hive学习之路 (二十)Hive 执行过程实例分析
  18. 24.Swap Nodes in Pairs (List; Two-Pointers)
  19. Your app uses or references the following non-public APIs的解决方案
  20. SpringBoot Mybatis keyProperty和useGeneratedKeys的作用

热门文章

  1. day11 前端知识简单总结
  2. 6——Z 字形变换(ZigZag Conversion)
  3. win10环境下配置django+Apache2.4.38+python3.6项目
  4. AtCoder Grand Contest 021完整题解
  5. 数据类型 scanf标准函数 sizeof关键字 二进制(day03)
  6. Nginx服务(端口80)
  7. 编译安装PHP7及扩展
  8. Atcoder ARC 082C/D
  9. HDU 4511
  10. [DLX精确覆盖] hdu 3663 Power Stations