首享一多很。等考指的似是很面一也者效下行插先提供渲染的数据是JS的JSON数据,然后根据提供的模板样朋支不器几事为的时后级功发发来久都这样含制层是请些间例业多在上屏屏有到式去渲染。
var html = document.getElementById("template").innerHTML;
var json = {
"title":"The title",
"content": [
{"name": "lily", "first": true},
{"name": "Lucy", "second": true, "url": "http://www.haohaoup.com"},
{"name": "Andy", "second": true, "url": "http://www.haohaoup.com"}
],
"img":"http://avatar.csdn.net/4/5/F/1_yiyaqin1990.jpg"
};
var _html = Mustache.to_html(html,json);
document.getElementById("content").innerHTML = _html;
本文来源于网络:查看 >https://blog.csdn.net/yiyaqin1990/article/details/7040387