Javascript 访问下划线模板中的JADE变量
我正在传递当前用户id(已登录用户的用户id),如 现在这意味着my home.jade文件可以访问currentUser变量 我可以用翡翠般的颜色接触到这个Javascript 访问下划线模板中的JADE变量,javascript,node.js,underscore.js,pug,underscore.js-templating,Javascript,Node.js,Underscore.js,Pug,Underscore.js Templating,我正在传递当前用户id(已登录用户的用户id),如 现在这意味着my home.jade文件可以访问currentUser变量 我可以用翡翠般的颜色接触到这个 p= currentUser 但是我想通过内部的下划线模板来访问这个变量 script(type='text/template') 我该怎么做 如果它是内联的,那么您应该能够使用{}返回变量 所以你想要 script(type='text/template'). var template = _.template("<b
p= currentUser
但是我想通过内部的下划线模板来访问这个变量
script(type='text/template')
我该怎么做 如果它是内联的,那么您应该能够使用
{}
返回变量
所以你想要
script(type='text/template').
var template = _.template("<b><%- value %></b>");
template({value: "#{currentuser}"});
script(type='text/template')。
var-template=551;.template(“”);
模板({value:{currentuser}});
script(type='text/template').
var template = _.template("<b><%- value %></b>");
template({value: "#{currentuser}"});