toxor88/yii2-widget-switchery 问题修复 & 功能扩展

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

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

toxor88/yii2-widget-switchery

最新稳定版本:1.0

Composer 安装命令:

composer require toxor88/yii2-widget-switchery

包简介

Enhanced Yii2 wrapper for the Switchery.js plugin.

README 文档

README

Latest Stable Version License Total Downloads Monthly Downloads Daily Downloads

iOS Switchery Slider (http://abpetkov.github.io/switchery/)

Installation

The preferred way to install this extension is through composer. Check the composer.json for this extension's requirements and dependencies.

To install, either run

$ php composer.phar require toxor88/yii2-widget-switchery "*"

or add

"toxor88/yii2-widget-switchery": "*"

to the require section of your composer.json file.

Demo

You can refer detailed documentation and demos on usage of the extension.

Usage

use toxor88\switchery\Switchery;
use yii\web\JsExpression;

// usage without model
echo '<label>Can do something?</label>';
echo Switchery::widget([
	'name' => 'can_do_something', 
	'clientOptions' => [
		'color'              => '#64bd63',
		'secondaryColor'     => '#dfdfdf',
        'jackColor'          => '#fff',
        'jackSecondaryColor' => null,
        'className'          => 'switchery',
        'disabled'           => false,
        'disabledOpacity'    => 0.5,
        'speed'              => '0.1s',
        'size'               => 'default',
	],
    'clientChangeEvent' => new JsExpression('function() {
        alert("checked: " + this.checked);
    }'),
]);

// usage with model
$form->model($model, 'attribute')->widget(Switchery::className(), [ /* widget options... */ ]);

// if you use the defualt ActiveField template, there can be multiple labels. To avoid it use:
// the label displays after the slider:
$form->model($model, 'attribute')->widget(Switchery::className(), [ /* widget options... */ ])->label(false);

// the label displays before the slider:
$form->model($model, 'attribute')->widget(Switchery::className(), [ 'options' => 'label' => null ])->label('label text or inherited from model');

License

yii2-widget-switchery is released under the BSD 3-Clause License. See the bundled LICENSE for details.

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: BSD
  • 更新时间: 2015-05-18