jaxon-php / jaxon-toastr
v1.0.2
2016-11-17 18:55 UTC
Requires
- jaxon-php/jaxon-core: ~1.0
This package is auto-updated.
Last update: 2022-02-01 12:59:10 UTC
README
此包通过使用 jQuery Toastr 库实现 Jaxon 应用中的 JavaScript 通知。 https://github.com/CodeSeven/toastr。
特性
- 丰富 Jaxon 响应中的通知功能。
- 自动将 Toastr 库的 Js 和 CSS 文件插入到 HTML 页面中。
安装
在 composer.json
文件中添加以下行。
"require": { "jaxon-php/jaxon-toastr": "1.0.*" }
或者运行以下命令
composer require jaxon-php/jaxon-toastr
配置
默认情况下,插件从 CDN JS 加载 Js 和 CSS 文件。
- cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js
- cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css
可以通过将 assets.include.toastr
选项设置为 false
来禁用此功能。
可以在 Jaxon 配置中的 toastr.options.
部分设置 Toastr 库的选项。有关选项的完整列表,请参阅 这里。
使用
此示例展示了如何打印通知。
function myFunction() { $response = new \Jaxon\Response\Response(); // Process the request // ... // Print a notification with Toastr $response->toastr->success("You did it!!!"); return $response; }
Jaxon 响应的 toastr
属性提供了与 Toastr 库相同的功能。
public function info($message, $title = null); public function success($message, $title = null); public function warning($message, $title = null); public function error($message, $title = null); public function remove(); public function clear();
贡献
- 问题追踪器:github.com/jaxon-php/jaxon-toastr/issues
- 源代码:github.com/jaxon-php/jaxon-toastr
许可
本项目采用 BSD 许可证。