ruturajmaniyar/yii2-flash-toastr
Composer 安装命令:
composer require ruturajmaniyar/yii2-flash-toastr
包简介
Toastr flash notification using jQuery with yii2
关键字:
README 文档
README
Toastr flash notification using jQuery with yii2
Current Version
v1.0 @stable @pre-release
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist ruturajmaniyar/yii2-flash-toastr: "dev-master"
or
composer require --prefer-dist ruturajmaniyar/yii2-flash-toastr: "dev-master"
or add
"ruturajmaniyar/yii2-flash-toastr": "dev-master"
to the require section of your composer.json file.
Usage
Once the extension is installed, simply use it in your code by :
<?php if (Yii::$app->session->hasFlash('success')): ?> <?= ToastrFlashMessage::widget([ 'type' => 'success', 'title' => 'Success', 'message' => Yii::$app->session->getFlash('success') ]); ?> <?php endif; ?> <?php if (Yii::$app->session->hasFlash('error')): ?> <?= ToastrFlashMessage::widget([ 'type' => 'error', 'title' => 'Error', 'message' => Yii::$app->session->getFlash('error') ]); ?> <?php endif; ?>
You can also use with below code
<?= ToastrFlashMessageSession::widget() ?>
With above code, extension set toastr message dynamically based on your flash session message
Other Options
'options' => [ "closeButton" => true, "newestOnTop" => true, "progressBar" => true, "positionClass" => ToastrFlashMessage::POSITION_TOP_RIGHT, "showDuration" => "300", "hideDuration" => "1000", "timeOut" => "5000", "extendedTimeOut" => "1000", "showEasing" => "swing", "hideEasing" => "linear", "closeEasing" => "linear", "showMethod" => "slideDown", "hideMethod" => "slideUp", "closeMethod" => "slideUp" ]
Toast Position Options:
POSITION_TOP_RIGHT = 'toast-top-right';
POSITION_TOP_LEFT = 'toast-top-left';
POSITION_TOP_CENTER = 'toast-top-center';
POSITION_TOP_FULL_WIDTH = 'toast-top-full-width';
POSITION_BOTTOM_RIGHT = 'toast-bottom-right';
POSITION_BOTTOM_LEFT = 'toast-bottom-left';
POSITION_BOTTOM_CENTER = 'toast-bottom-center';
POSITION_BOTTOM_FULL_WIDTH = 'toast-bottom-full-width';
DEMO
统计信息
- 总下载量: 5.05k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2019-06-10