Meaulnes
Meaulnes

Reputation: 487

Modal created with livewire-ui/modal doesn't close

I am checking the livewire-ui/modal as described in this github page

The modal is showing properly when the open button is clicked but it never closes whatever the mean used is, e.g. :

<button wire:click="$emit('closeModal')">No, do not delete</button>
<button class="button-link" wire:click.prevent="close()"> Poster</button>

and having the close function in the modal like this:

<?php

namespace App\Http\Livewire;

use LivewireUI\Modal\ModalComponent;

class Hello extends ModalComponent
{
    public function render()
    {
        return view('livewire.hello');
    }

    public function close(){
        
        $this->closeModal();
    }
}

Upvotes: 1

Views: 1096

Answers (1)

Meaulnes
Meaulnes

Reputation: 487

The functioning was due to the fact that I had 2 alpine in the page One as directly in the page (CDN) and the other inside app.js (require 'alpinejs'). I just kept require 'alpinejs' and now it works.

Upvotes: 1

Related Questions