Syn*_*sso 4 scalatra scalate pug
(注意,这是Scalate Jade,如果这有所不同)
我有以下路线:
get("/fruit") {
contentType = "text/html"
jade("fruity", "fruit" -> "apple")
}
Run Code Online (Sandbox Code Playgroud)
这个fruity.jade模板:
-@ val fruit: String
p Alerting #{fruit}
:javascript
alert("#{fruit}");
Run Code Online (Sandbox Code Playgroud)
它呈现如下:
<body><p>Alerting apple</p>
<script type="text/javascript">
//<![CDATA[
alert("#{fruit}");
//]]>
</script>
</body>
Run Code Online (Sandbox Code Playgroud)
该fruit值不是针对javascript部分进行插值的.我怎样才能在javascript中解决它?