bfg / puller-livewire
puller-livewire 的描述。
1.0.0
2022-01-01 19:06 UTC
Requires
- bfg/puller: 2.*
- livewire/livewire: ^2.8
This package is auto-updated.
Last update: 2024-08-29 05:44:28 UTC
README
安装
composer require bfg/puller-livewire
此软件包是 Puller
的插件。
导航到 链接 读取文档,文档位于 https://github.com/bfg-s/puller。
用法
确保在您的 public/vendor
文件夹中发布了 puller-livewire/puller-livewire.js
。它必须在安装软件包后立即出现,因为它在 laravel-assets
组中进行了发布。如果没有发生这种情况,并且它没有在那里出现,请手动发布它
php artisan vendor:publish --tag=puller-livewire-assets
在 Livewire 初始化后连接脚本
@livewireScripts() <script src="{{ asset('vendor/puller-livewire/puller-livewire.js') }}"></script>
在 Livewire 组件中创建事件
class OrderTracker extends Component { public $showNewOrderNotification = false; // Special Syntax: ['puller:{event}' => '{method}'] protected $listeners = ['puller:livewire_event_name' => 'notifyNewOrder']; public function notifyNewOrder() { $this->showNewOrderNotification = true; } }
发送名为 livewire_event_name
的指南类或匿名频道。
变更日志
请参阅 CHANGELOG 了解最近更改的更多信息。
致谢
安全
如果您发现任何安全相关的问题,请通过电子邮件 xsaven@gmail.com 而不是使用问题跟踪器。
许可
MIT 许可证 (MIT)。有关更多信息,请参阅 许可文件。