如何将 class 名称或数据-* 添加到 widdof "nex/yii2-chosen"

How do I add a class name or data-* to widgetof "nex/yii2-chosen"

我正在使用 "nex/yii2-chosen" 以及如何在下面的示例

中添加 'class' 属性或 'data-*'
<?=
$form->field($model, "vehicle_id")->widget(Chosen::className(), [
    'items' => $VehicleList,
    'disableSearch' => 5,
    'class' => 'vehicle_id form-control input-sm',    <---------------not working
    'clientOptions' => [
        'search_contains' => true,
        'single_backstroke_delete' => false,
    ]
]) ?>

你只需要把它们放在 options 属性.

<?=
$form->field($model, "vehicle_id")->widget(Chosen::className(), [
    'items' => $VehicleList,
    'disableSearch' => 5,
    'options' => [
        'class' => 'vehicle_id form-control input-sm',
    ],
    'clientOptions' => [
        'search_contains' => true,
        'single_backstroke_delete' => false,
    ]
]) ?>