我在 play framework 中定义了一个自定义的 Bootstrap 字段构造函数
@(elements: helper.FieldElements)
<div class="control-group@if(elements.hasErrors) { error}">
<label class="control-label" for="@elements.id">CIAO@elements.label(elements.lang)</label>
<div class="controls">
@elements.input
@elements.errors(elements.lang).map { error =>
<span class="help-inline">@error</span>
}
</div>
</div>
它按预期工作,除非我将字段放在重用视图块中:@(editForm: Form[Azienda]) @import helper._ @import crudder.viewhelpers.html.bootstrap.f @implicitField = @{ FieldConstructor(crudder. viewhelpers.html.bootstrap.f) }
@editFields() = {
@inputText(editForm("descrizione"), '_label -> "Ragione sociale")
}
@main("Amministrazione - Aziende") {
<!--This one use my customized block-->
@inputText(editForm("descrizione"), '_label -> "Ragione sociale")
<!--This one don't work!-->
@editFields()
}
关于如何使可重用块使用我的自定义构造函数的任何想法?