alexantr/yii2-colorpicker

适用于Yii 2的颜色选择器输入小部件

安装次数: 3,776

依赖者: 0

建议者: 0

安全性: 0

星级: 3

关注者: 1

分支: 0

公开问题: 0

类型:yii2-extension

2.0.0 2018-02-09 14:08 UTC

This package is auto-updated.

Last update: 2024-09-23 15:00:04 UTC


README

此扩展可以渲染一个带有 jQuery MiniColors 的输入。

Latest Stable Version Total Downloads License

注意:1.x 版本使用 jscolor Color Picker

安装

通过 composer 安装扩展

composer require alexantr/yii2-colorpicker

使用方法

以下代码在视图文件中会渲染一个带有颜色选择器的输入

<?= alexantr\colorpicker\ColorPicker::widget(['name' => 'attributeName']) ?>

如果您想在ActiveForm中使用此输入小部件,可以这样做

<?= $form->field($model, 'attributeName')->widget(alexantr\colorpicker\ColorPicker::className()) ?>

应使用 clientOptions 属性来配置 jQuery MiniColors

<?= alexantr\colorpicker\ColorPicker::widget([
    'name' => 'attributeName',
    'clientOptions' => [
        'control' => 'wheel',
        'letterCase' => 'uppercase',
        'theme' => 'default', // the widget uses 'bootstrap' theme
    ],
]) ?>