zys/livewire-alert

livewire alert 组件

dev-main 2021-01-06 11:20 UTC

This package is auto-updated.

Last update: 2024-09-06 20:01:09 UTC


README

Build Status Packagist License

livewire alert 组件.

安装

$ composer require zys/livewire-alert -vvv

要求

此包在内部使用 Livewire。请在使用此包之前确保将其包含在依赖项中。

  • PHP 7.2 或更高版本
  • Laravel 8
  • Livewire
  • tailwindcss

用法

添加 livewire-alert 组件

<body>
...
@livewire('livewire-alert')
</body>

在 livewire 组件中显示消息

public function showMessage()
{
    ...
    $this->alert('info', 'Message~', ['content' => 'Message Content', 'timeout' => 3000]);
}

在 JavaScript 中显示消息

window.livewire.emitTo('livewire-alert', 'livewireAlert', {
    type: 'info',
    message: 'Message',
    options: {
        content: 'Message content~',
        timeout: 3000,
    }
})

贡献

您可以通过以下三种方式之一进行贡献

  1. 使用 问题跟踪器 提交错误报告。
  2. 问题跟踪器 上回答问题或修复错误。
  3. 贡献新功能或更新 wiki。

代码贡献流程并不非常正式。您只需确保遵循 PSR-0、PSR-1 和 PSR-2 编码指南。任何新的代码贡献都必须附有适用的单元测试。

许可证

MIT