sem-soft/yii2-widgets

Yii2 框架的附加基本小部件集合

安装数: 2,008

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放性问题: 0

类型:yii2-widgets

1.0.3 2018-02-12 15:59 UTC

This package is auto-updated.

Last update: 2024-09-07 07:32:21 UTC


README

通过 composer 安装

composer require sem-soft/yii2-widgets

或者将以下代码添加到 composer.json 的 require 部分,然后在控制台运行 composer update

"sem-soft/yii2-widgets": "*"

无模型的使用

<?= sem\widgets\TransliterationInput::widget([
  'name'      =>  'in',
  'targetId'  =>  'test',
]);?>
<?= \yii\helpers\Html::textInput('out', null, [
  'id'    =>	'test'
]);?>

使用 ActiveForm 标记的使用

 <?= $form->field($model, 'name')->widget(sem\widgets\TransliterationInput::className(), [
   'maxlength' =>  true,
   'targetId'  =>  'company-code'
 ]);?>
 <?= $form->field($model, 'code')->widget(MaskedInput::className(), [
   'id'          =>  'company-code',
   'mask'        =>  '*{2,64}',
   'definitions' =>  [
     '*' =>  [
       'validator'   =>  '[a-z0-9-]',
       'cardinality  =>  1,
       'casing'      =>  'lower'
   ]
 ],
 'clientOptions'	=>	[
   'autoUnmask'=>true
 ]
]);?>