[英]how to do an expression inside the .scala.html file in play framework
I want to ask how to do an expression inside the .scala.html file in play framework. 我想问一下如何在play框架的.scala.html文件中执行表达式。 You can do the scala codes by puting an @ sign for every scala code.
您可以通过为每个Scala代码添加@符号来执行Scala代码。 You can also define a variable by:
您还可以通过以下方式定义变量:
@defining(0){ i =>
@ i
}
the code above displays 0 but what i want to ask is how can i do an expression on the variable i. 上面的代码显示0,但我想问的是如何在变量i上执行表达式。 for example i want to do:
例如,我想做:
@i = i + 1
whenever i type this inside the .scala.html file in displays: 每当我在显示的.scala.html文件中键入以下内容时:
0 = i + 1
what i want is i modified after an expression. 我想要的是在表达后修改的。
THANK YOU. 谢谢。
试试这个表达式:
@i = @{1 + 1}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.