Level 122
use mount() not __construct()
how are these components loaded?
Good afternoon friends, there is a problem, events do not work, tell me what the problem is, please help?
I added weight to the code, can you help me?
JokerComponent.php
namespace App\Livewire;
use Jantinnerezo\LivewireAlert\LivewireAlert;
use Livewire\Attributes\Url;
use Livewire\Component;
use Livewire\WithPagination;
class JokerComponent extends Component
{
use WithPagination, LivewireAlert;
#[Url(history: true)]
public string $search = '';
public array $params = [];
public function mount()
{
$this->params = request()->route()->parameters();
}
public function upperWords($word): string
{
return mb_convert_case($word, MB_CASE_TITLE, "UTF-8");
}
}
Statements.php
namespace App\Livewire\Meros;
use App\Livewire\JokerComponent;
use Livewire\Attributes\On;
class Statements extends JokerComponent
{
#[On('delete-statement')]
public function delete(): void
{
dd('Hello');
}
}
ViewMeros.php
namespace App\Livewire\Meros;
use App\Livewire\JokerComponent;
class ViewMeros extends JokerComponent
{
public Meros $meros;
public function render(){
return view('components.meros.view-meros', [
'meros' => $meros
]);
}
public function check()
{
$this->dispatch('delete-statement');
}
}
in view (components.meros.view-meros)
<button class="ui button" wire:click="check()">
<i class="delete icon"></i>
</button>
Please or to participate in this conversation.