yii2 时间控件用法

来源:互联网 发布:mac editplus 编辑:程序博客网 时间:2024/06/05 05:45

1 使用widget方式

<?= DatePicker::widget([    'model' => $model,    'attribute' => 'date',    'template' => '{addon}{input}',    'clientOptions' => [         'autoclose' => true,         'format' => 'dd-M-yyyy'    ]]);?>

2 ActiveForm方式

<?= $form->field($model, 'date')->widget(    DatePicker::className(), [        // inline too, not bad        'inline' => true,         // modify template for custom rendering        'template' => '<div class="well well-sm" style="background-color: #fff; width:250px">{input}</div>',        'clientOptions' => [            'autoclose' => true,            'format' => 'dd-M-yyyy'        ]]);?>

原文传送点

0 0
原创粉丝点击