oakcms / yii2-bootstrap-switch
渲染一个 Bootstrap 切换开关插件小部件。
v1.0.0
2016-06-01 14:47 UTC
Requires
- bower-asset/bootstrap-switch: *
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-09-23 13:04:38 UTC
README
渲染一个 Bootstrap 切换开关插件小部件。
安装
安装此扩展的首选方式是通过 composer。
运行
php composer.phar require --prefer-dist oakcms/yii2-bootstrap-switch "*"
或者在您的 composer.json
文件的 require 部分添加
"oakcms/yii2-bootstrap-switch": "*"
。
使用方法
扩展安装完成后,只需在您的代码中简单使用即可
<?= $form->field($model, 'field')->widget(\oakcms\bootstrapswitch\Switcher::className()) ?>
或者
<?= \oakcms\bootstrapswitch\Switcher::widget([ 'name' => 'Name', 'checked' => true, 'clientOptions' => [ 'size' => 'large', 'onColor' => 'success', 'offColor' => 'danger' ] ]); ?>