loveorigami / yii2-bootstrap-toggle
Yii2 bootstrap-toggle 小部件
1.1
2016-05-12 15:57 UTC
Requires
- bower-asset/bootstrap-toggle: *
- yiisoft/yii2: 2.0.*
Requires (Dev)
- yiisoft/yii2-debug: 2.0.*
This package is auto-updated.
Last update: 2024-09-21 20:16:14 UTC
README
此扩展为 Yii2 框架提供了 Bootstrap-toggle 集成。
安装
此扩展需要 Bootstrap-toggle
安装此扩展的首选方法是使用 composer。
运行以下命令之一:
php composer.phar require --prefer-dist loveorigami/yii2-bootstrap-toggle "*"
或者添加以下内容到你的 composer.json 文件的 require 部分。
"loveorigami/yii2-bootstrap-toggle": "*"
```
通用用法
use lo\widgets\Toggle; Toggle::widget( [ 'name' => 'status', // input name. Either 'name', or 'model' and 'attribute' properties must be specified. 'checked' => true, 'options' => [], // checkbox options. More data html options [see here](http://www.bootstraptoggle.com) ] )
或者与活动表单一起使用
<?= $form->field($model, 'status')->widget(Toggle::className(), [ 'options' =>[ 'id' => 'my-id', ] ] ); ?>