lbreda/livewire3-notify
最新稳定版本:v1.0
Composer 安装命令:
composer require lbreda/livewire3-notify
包简介
Simple Notify binding for Livewire3
README 文档
README
Livewire3 Notify is a Livewire3 binding for SimpleNotify. That's it.
Installation
You have to install both SimpleNotify and this library:
npm i simple-notify composer require lbreda/livewire3-notify
Then you should include the SimpleNotify scripts in your app.js (or equivalent):
import Notify from 'simple-notify' import 'simple-notify/dist/simple-notify.css' window.Notify = Notify
And this library component in your main layout:
<html> <head> ... @simpleNotify() </head> <body> ... </body> </html>
Usage
You can simply dispatch the notify event inside your Livewire application. You can set the Simple Notify parameters (here is a reference) in the payload.
For example, you can use it in a component method:
#[On('test')] public function test(): void { $this->dispatch('notify', status: 'error', title: 'Error', text: 'Send halp'); }
or you can use it in a view:
<div> <button type="button" wire:click="$dispatch('notify', {status: 'error', title: 'Error', text: 'Send halp'})">Notify</button> </div>
Setting up the default configuration
You can export the default configuration via:
php artisan vendor:publish --provider 'LBreda\Livewire3Notify\Providers\SimpleNotifyServiceProvider'
You'll find a simple-notify.php file in your config directory. Customise it as you like.
Happy coding!
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3
- 更新时间: 2024-08-13