发表于 2017-05-08 类似于jsp,模板引擎 <% = 表达式%> 返回一个字符串 <% 表达式%> 执行js代码 模板文件render with jsonData 12// load the template file, then render it with datavar html = new EJS({url: 'cleaning.ejs'}).render(data); view helpers 12345<li> <a href='supplies/<%= supplies[i] %>'> <%= supplies[i] %> </a></li> 用view helper:link_to 等价于上边 123<li> <%= link_to(supplies[i], 'supplies/'+supplies[i]) %></li>