wire-elements / modal

Livewire component that provides you with a modal that supports multiple child modals while maintaining state.
MIT License
1.12k stars 133 forks source link

Component does not implement [LivewireUI\Modal\Contracts\ModalComponent] interface #424

Closed saulo-arantes closed 7 months ago

saulo-arantes commented 7 months ago

anyone can help me? im getting this error for a while and cant find where the error is

use Illuminate\View\View;
use LivewireUI\Modal\ModalComponent;

class VerFoto extends ModalComponent
{
    public string $foto;

    public function mount(string $foto)
    {
        $this->foto = $foto;
    }

    public function render(): View
    {
        return view('livewire.ver-foto');
    }
}

ver-foto.blade.php

<div>
    <img src="{{ $foto }}" alt="foto">
</div>

and i have this code that calls the openModal event:

<div class="p-6 cursor-pointer" onclick="Livewire.dispatch('openModal', { component: 'ver-foto', arguments: { foto: '{!! $foto !!}' } })">
    <img src="{{ $foto }}" class="w-48 rounded">
</div>

and when i click on it, i get this error:

[Livewire\Volt\Component@anonymous/var/www/html/storage/framework/views/fb4c8820941014dcd9300c5855e9b00d.php:8$24b] does not implement [LivewireUI\Modal\Contracts\ModalComponent] interface.