根据文档,传递变量到模板中渲染可以通过以下方式:
var template = require("pug!./file.pug");
// => returns file.pug content as template function
// or, if you've bound .pug to pug-loader
var template = require("./file.pug");
var locals = { /* ... */ };
var html = template(locals);
// => the rendered HTML
传递字符串类型过模板中可以正常渲染出来,请问如何传递OBject类型到pug中遍历输出内容?
饮歌长啸
相关分类