kak/input-switch 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kak/input-switch

Composer 安装命令:

composer require kak/input-switch

包简介

bootstrap switch for Yii2

README 文档

README

bootstrap-switch widget for Yii2

Documentation

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist kak/input-switch "dev-master"

or add

"kak/input-switch": "dev-master"

to the require section of your composer.json file.

Usage

ActiveForm

echo $form->field($model, 'list')->widget('\kak\widgets\InputSwitch\InputSwitch', [
	'options' => [
		'data-id'   => $model->id,
		'data-size' => 'small'
	],
]) ?>

Native

echo  \kak\widgets\InputSwitch\InputSwitch::widget([
	'name' => 'OperatorSwitch[' . $model->id . ']',
	'value' => $model->status == true,
	'options' => [
		'data-id'   => $model->id,
		'data-size' => 'small'
	]
]);

Use Events

$js =<<<JS
   $('.InputSwitch').on('switchChange.bootstrapSwitch', function(event, state) {
      $.post('/finance/credit-operator-switch',{status: state, id: $(this).data('id') })
    });
JS;
$this->registerJs($js)
?>

统计信息

  • 总下载量: 925
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-12-14