需要打印 Jade 模板注释中的参数值。值传入正确;以下内容按预期工作:
if type !== "surveyFree"
ul.pollOptions
for answer, idx in answers
li
+printAnswer(answer, idx)
else
textarea(cols="50", rows="4", placeholder="Type in your answer")
但是,所有打印注释中 type
变量值的尝试都失败了。我尝试过以下形式:
// "type = " + type
// #{"type = " + type}
// span= #{"type = " + type}
// span= type = #{type}
还有许多其他的,但没有任何效果(所有内容都按照我输入的内容准确打印)。我想要输出:
<!-- type = challenge -->
或
<!-- type = survey -->
感谢所有帮助!
最佳答案
也许这种方式对你有好处:
!='<!-- COMMENT VARAIBLE: ' + variable + '-->'
关于javascript - 在 Jade 模板中打印注释内的表达式值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33050625/