var jsrender = require('jsrender');var tmpl = jsrender.templates('{ {:name}}'); // Compile template from stringvar data=new Array();data[0]={};data[0].address=new Array();data[0].address[0]={city:"1"};data[0].address[1]={city:"2"};data[0].name="ada";data[1]={};data[1].address=new Array();data[1].address[0]={city:"1"};data[1].address[1]={city:"2"};data[1].name="ada.young";var html = tmpl.render(data); // Renderconsole.log(html);
adaada.young
{ {for}} 也可以遍历,不过他是遍历对象下某个属性是集合的数据