sandritsch91/yii2-widget-autosize
最新稳定版本:1.0.0
Composer 安装命令:
composer require sandritsch91/yii2-widget-autosize
包简介
An autosize widget for yii2
README 文档
README
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist sandritsch91/yii2-widget-autosize
or add
"sandritsch91/yii2-widget-autosize": "*"
to the require section of your composer.json
Usage
with a model:
use sandritsch91\yii2-widget-autosize\Autosize; echo Autosize::widget([ 'model' => $model, // The model to be used in the form 'attribute' => 'content', // The attribute to be used in the form 'htmlClass' => yii\bootstrap5\Html::class, // Optional. The class used to generate the form field 'clientEvents' => [ // Optional. Pass the client events to be attached to the textarea 'autosize:resized' => 'function() { console.log("resized"); }' ] ]);
with an ActiveForm:
use sandritsch91\yii2-widget-autosize\Autosize; echo $form->field($model, 'content')->widget(Autosize::class, [ 'clientEvents' => [ 'autosize:resized' => 'function() { console.log("resized"); }' ] ]);
without a model:
use sandritsch91\yii2-widget-autosize\Autosize; echo Autosize::widget([ 'name' => 'myText', // The name of the input 'value' => 'Hello World', // The value of the input 'clientEvents' => [ 'autosize:resized' => 'function() { console.log("resized"); }' ] ]);
Widget options
- clientEvents: The client events to be attached to the textarea. Defaults to []
- autosize:resized: Triggered when the textarea is resized
- autosize:update: Dispatch this event to update the textarea. No event is triggered by the plugin
- autosize:destroy: Dispatch this event to destroy the textarea. No event is triggered by the plugin
- htmlClass: The class used to generate the form field. Defaults to yii\helpers\Html::class
统计信息
- 总下载量: 434
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-04-16