loveorigami/yii2-bootstrap-toggle

Yii2 bootstrap-toggle 小部件

安装数量: 133,048

依赖项: 0

建议者: 0

安全: 0

星标: 4

关注者: 3

分支: 9

开放问题: 0

类型:yii2-extension

1.1 2016-05-12 15:57 UTC

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',
			]
		]
	); ?>