我想在视图文件中声明一个scala变量。怎么办呢?
@(title: String)(content: Html)
//this line isnt compiling. I tried without the word defining but it doesn't work either
@defining(l:Seq[String] = Seq("hello","hello2"))
<html><head>...
<body>
@content
//I want to use the list here
<ul id="hardcode-list" >
@l.map{item=><li>item</li>}
</ul>
</body>
</head></html>
答案 0 :(得分:0)
为了完整起见,我通过此代码解决了我的问题
<ul id="hardcode-list" >
@defining(List("hello","hello2")){l=>
@l.map{item=>
<li>@item</li>
}
}