nodejs 模板 ejs 入门 helloworld

来源:互联网 发布:php单选框提交 编辑:程序博客网 时间:2024/04/19 20:34
npm isntall ejs
var ejs = require("ejs");var tpl = "<% myList.forEach(function(item){  %>hello <%=item%> <br /> <% }) %> ";var data = {"myList":["hehe","xixi"]};console.log(ejs.render(tpl,data));
参考文档:https://www.npmjs.com/package/ejs
0 0