abushamleh/yii2-toast

Yii2 toast 提醒

安装数: 2,873

依赖者: 0

建议者: 0

安全性: 0

星星: 3

关注者: 3

分支: 0

公开问题: 0

语言:JavaScript

类型:yii2-extension

dev-master 2018-11-04 22:41 UTC

This package is not auto-updated.

Last update: 2024-09-18 05:10:58 UTC


README

运行Composer命令以安装最新版本

composer require abushamleh/yii2-toast "dev-master"

用法

ToastAlert

use abushamleh\toast\ToastAlert;

echo ToastAlert::widget([
    'options'   => [],
    'heading'   => 'heading',
    'text'      => 'text',
    'type'      => 'type',
]);

ToastBlock

ToastBlock小部件从会话闪存中渲染消息。所有闪存消息都按使用setFlash分配的顺序显示。

use abushamleh\toast\ToastBlock;

//You can set message as following:
 Yii::$app->session->setFlash('error', 'This is the message');
 Yii::$app->session->setFlash('success', 'This is the message');
 Yii::$app->session->setFlash('info', 'This is the message');
 Yii::$app->session->setFlash('info', ['heading' => 'Message title' 'text' => 'This is the message']);

//Multiple messages could be set as follows:
 Yii::$app->session->setFlash('error', ['Error 1', 'Error 2']);
 Yii::$app->session->setFlash('error', [['heading' => 'Message title' 'text' => 'This is the message'], 'Error 2']);

echo ToastBlock::widget([
    'options' => []
]);