将node.js中的参数渲染为文本

时间:2016-05-19 13:38:01

标签: javascript node.js pug

我正在使用node.js,用jade / pug表达。

作为一个例子,我在index.js文件中有以下内容。

 res.render('index', { x: 'home' });

作为确保我正确传递值的测试,我使用以下内容在index.pug上显示值'home'。

 #{x}

这会将值呈现为标记主页。

 <home></home> instead of the word home

我如何获得主页而不是标签? 我如何将价值纳入

 include ../components/#{x}.pug

0 个答案:

没有答案