统一修改
$form = ActiveForm::begin([
'fieldConfig' => [
'options'=>['class' => 'weui-cell weui-cell_access'],//修改 {label} 上一层样式
'template' => "<div class='col-sm-3 text-left'>{label}</div><div class='col-sm-9'>{input}\n{hint}\n{error}</div>",
'labelOptions' => ['class' => 'weui-label'],//修改label样式
'inputOptions' => ['class' => 'weui-input'],//修改input样式
]
]);
指定修改
原来activeForm field 默认输出的html 代码不能满足项目需求,需要在原来基础上添加其他一些html代码。
例如:<?= $form->field($model, 'username',)->textInput(['value'=>$model->username]) ?>
改成:
<?= $form->field($model, 'username',[
'template' => "{label}\n{input}\n{hint}<p class='fa fa-user'>ssdfsdfd</p>\n\n{error}"
])->textInput(['value'=>$model->username]) ?>
{label}\n{input}\n{hint}<p class='fa fa-username'>ssdfsdfd</p>\n\n{error}