一、doT.js使用笔记
2024-10-07 05:56:23
一、赋值https://www.jianshu.com/p/19156f9fac1e
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
<title>云API</title>
<link rel="stylesheet" type="text/css" href="../css/api.css"/>
<link rel="stylesheet" type="text/css" href="../css/style.css"/>
</head>
<body>
<header>
</header>
<div id="show_list"></div>
</body>
<script src="https://cdn.bootcss.com/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="script/api.js"></script>
<script src="https://cdn.bootcss.com/dot/1.1.2/doT.min.js"></script>
<script id="tpl" type="text/x-dot-template">
<div>Hi {{=it.name}}!</div>
<div>{{=it.age || ''}}</div>
</script>
<script type="text/javascript">
apiready = function () {
var data = {"name":"Jake","age":31};
var show_tpl = doT.template($("#tpl").text());
//$("#show_list").html(show_tpl(data)); //jq 方式
$api.html($api.byId('show_list'),show_tpl(data))
}
</script>
</html>
最新文章
- Linux 的 strace 命令
- Designing for iOS: Graphics &; Performance
- [Nginx] 关键概念解读
- IOS Xcode 无法识别IOS device 突然发生的
- ethtool 在 Linux 中的实现框架和应用
- .jar是什么文件?(转载)
- GUI编程笔记(java)05:GUI事件监听机制原理和举例说明
- Jetty总览
- 用json方法来作深拷贝应该知道的一点东西!
- windows sevser 2012搭建网站
- 通过地址获得经纬度(百度Geocoding API)
- 【非官方】Surging 微服务框架使用入门
- TextView走马灯
- Python-Django-Ajax进阶3
- Leetcode480-Binary Tree Paths-Easy
- oracle 查询非自增长分区的最大分区
- Zbrush Topogun 备忘
- JDBC的DBUtils源码
- SpringBatch Sample (五)(复合格式文件的读、多文件的写)
- DOM常用的属性和方法