Code Monkey home page Code Monkey logo

Comments (3)

mokhosh avatar mokhosh commented on September 26, 2024

Here's a simplified version of my Livewire blade template:

@foreach($models as $model)
<tr>
    <td>{{ $model->id }}</td>
    <td>{{ $model->name }}</td>
    <td x-data="{ isDeleting: false }">
        <button @click="isDeleting = true">Delete</button>
        <div class="modal" x-show="isDeleting">
            <div class="overlay" @click="isDeleting = false"></div>

            <div class="modal-content">
                <p>Delete {{ $model->name }} model?</p>
                <button wire:click="delete({{ $model->id }})" @click="isDeleting = false">Delete</button>
            </div>
        </div>
    </td>
</tr>
@endforeach

from alpine-plugin.

mokhosh avatar mokhosh commented on September 26, 2024

This is the order in which I've imported assets:

@livewireScripts {{-- version 0.7.4 --}}
<script src="https://cdn.jsdelivr.net/gh/livewire/alpine-plugin@v0.1.0/dist/livewire-alpine-plugin.js"></script>
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.0.0/dist/alpine.js" defer></script>

from alpine-plugin.

mokhosh avatar mokhosh commented on September 26, 2024

I red the code for alpine plugin and alpine's index.js and figured a hacky way to fix this. I put an x-data attribute on my livewire components root element.

But this should work without a hack. if the root element isn't an alpine component but some parts of new html returned by livewire contains tags with x-data they should be initialized.

from alpine-plugin.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.