0
我想創建一個具有可選內容的標記......比方說,我有一個標籤標籤/可選內容視圖捻:</p> <p><strong>應用程序/視圖/標籤/ part.scala.html</strong>:
@(param: String)(content: Html = null)
@if(content == null) {
@param: Your tag has no content...
} else {
@param: @content
}
而且我喜歡用它在我的觀點是:
@tags.part("foo"){ <b>Good!</b} }
或
@tags.part("bar")
不幸的是第二個電話給我的編譯錯誤:
missing arguments for method apply in object part;
follow this method with `_' if you want to treat it as a partially applied function
我如何可以通過它無需使用@tags.part("bar"){ }
或@tags.part("bar"){_}
(和標籤if body != "_"
檢查)?
隱含內容的伎倆要求,THX – biesior 2014-11-10 11:27:44