marqu3s/yii2-sweet-alert

基于 SweetAlert 扩展的 Alert 小部件 http://tristanedwards.me/sweetalert

安装次数: 308

依赖项: 0

建议者: 0

安全: 0

星标: 2

关注者: 3

分支: 18

类型:yii2-extension

v1.0.0 2017-09-18 17:26 UTC

This package is auto-updated.

Last update: 2024-09-24 20:24:53 UTC


README

安装

安装此扩展的首选方式是通过 composer

运行以下命令之一

php composer.phar require --prefer-dist marqu3s/yii2-sweet-alert "*"

"marqu3s/yii2-sweet-alert": "*"

将以下内容添加到您的 composer.json 文件的 require 部分。

使用方法

安装扩展后,只需将小部件添加到您的页面,如下所示

  1. 默认用法,通过 Yii::$app->session->setFlash() 渲染存储在会话 flash 中的所有闪存消息。
echo Alert::widget(); 
  1. 自定义用法示例
echo Alert::widget([
          'useSessionFlash' => false,
          'options' => [
               'title' => 'Success message',
               'type' => 'Success',
               'text' => "You will not be able to recover this imaginary file!",
               'confirmButtonText'  => "Yes, delete it!",   
               'cancelButtonText' =>  "No, cancel plx!"
          ]
]);

Alert 选项

您可以在 选项页面 找到它们