如何在play framework视图页面中调用scala方法

如何在play framework视图页面中调用scala方法,scala,playframework,Scala,Playframework,我在新的游戏框架中,我对这些问题有疑问,游戏框架中的任何专家都应该回答这些问题 In play framework the scala methods are how to invoke inside view ? these method will create inside the application or model in the project 关于你,普拉桑特 my language is not good I know, and sorry about that 要在Twi

我在新的游戏框架中,我对这些问题有疑问,游戏框架中的任何专家都应该回答这些问题

In play framework the scala methods are how to invoke inside view ?

these method will create inside the application or model in the project
关于你,普拉桑特

my language is not good I know, and sorry about that

要在Twirl的模板中定义方法,请在名称和代码块之前添加
@

@incr(number: Int) = @{ @number + 1 }
要调用scala方法或变量,请在名称前添加
@
符号

<div>@incr(10)</div>
@incr(10)

将返回并打印
div
block

中的
11
,以在Twirl的模板中定义方法,在名称和代码块之前添加
@

@incr(number: Int) = @{ @number + 1 }
要调用scala方法或变量,请在名称前添加
@
符号

<div>@incr(10)</div>
@incr(10)
将返回并在
div
块中打印
11