aki / yii2-make-button
用于创建按钮
1.0
2017-02-11 15:53 UTC
Requires
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-09-13 11:19:13 UTC
README
用于创建按钮
安装
安装此扩展的首选方式是通过composer。
运行以下命令:
php composer.phar require aki/yii2-make-button "*"
或者在您的composer.json
文件的require部分添加:
"aki/yii2-make-button": "*"
to the require section of your composer.json
file.
使用方法
扩展安装后,您只需在代码中简单地使用它即可
<?= \aki\button\MakeButton::widget([ 'text' => '<i class="fa fa-edit"></i> hello', ]); ?>
同时创建ajax请求示例
<?= aki\button\MakeButton::widget([ 'text' => '<i class="fa fa-edit"></i> hello', 'ajax' => [ 'onSendRequest' => 'click', 'url' => Url::toRoute(['post/index']), 'type' => 'POST', 'success' => new yii\web\JsExpression(' function(data){ alert(data); } '), 'data' => new yii\web\JsExpression("datafrom('#form')"), ] ]);?>
同时存在不同的皮肤
样式
bootstrap
createive
设置皮肤creative
<?= aki\button\MakeButton::widget([ 'text' => '<span>Add to cart</span>', 'skin' => 'creative', 'options' => [ 'class' => aki\button\MakeButton::style()->creative->btn3e_send ], ]);?>