Closed Fred7877 closed 2 years ago
Hi @Fred7877, can you show me how you import sweetalert2 and livewire alert scripts?
@extends('layouts.admin')
@section('content_admin')
{{$dataTable->table()}}
@stop
@push('js')
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<x-livewire-alert::scripts />
<script src="{{ asset('vendor/livewire-alert/livewire-alert.js') }}"></script>
<x-livewire-alert::flash />
{{$dataTable->scripts()}}
@endpush
You can just either import
<x-livewire-alert::scripts />
or
<script src="{{ asset('vendor/livewire-alert/livewire-alert.js') }}"></script>
because you are importing the script twice.
You can check the demo repo: https://github.com/jantinnerezo/livewire-alert-demo/blob/main/resources/views/layouts/master.blade.php
When using <x-livewire-alert::scripts />
, you don't need to include the <x-livewire-alert::flash />
anymore.
Thanks ! it's clear the error message :)
Regards,
Great! closing it now. Thanks!
Hello @jantinnerezo !
I get a sweetAlert2 error in the javascript console when I use alert() or confirm():
sweetalert2@10:1 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'then') at i.value (sweetalert2@10:1)
I have tested with sweetalert2@11, same thing.
I don't know if you can do anything or if you know about this mistake...
Regards,