我正在尝试创建一个仅包含可被其他视图使用的可重用 HTML 块的视图。想知道这样的事情是否可行:
在views.home.common.scala.html 中:
@component1 = {
some common html
}
@component2 = {
some other stuff
}
在views.home.sample.scala.html 中:
@(user:User)
import home._
@component1
@common.component2
到目前为止还没有任何运气,我在示例中没有看到任何类似的东西,但是模板常见用例中涵盖了这个想法。