[英]javascript between jade file failed
My below code broken 我的下面的代码坏了
span
a.active(href="#{code}")
- myArr.forEach(entry){
if(entry.code == code){
#{entry.ItemName}
}
}
My expected result is 我的预期结果是
<span><a href="John">John James</a></span>
You're mixing javascript to be executed by Jade with output code. 您正在将要由Jade执行的javascript与输出代码混合在一起。 Use this:
用这个:
span
a.active(href = code)
each entry in myArr
if entry.code == code
= entry.ItemName
Changes: 变化:
each...in
each...in
tag = variable
for interpolation when possible, not #{variable}
tag = variable
进行插值,而不是#{variable}
if
doesn't need parens if
不需要parens
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.