1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Why can not install photoswipe on laravel 11 site?

Discussão em 'Outras Linguagens' iniciado por Petro Gromovo, Outubro 7, 2024 às 09:22.

  1. I try to add photoswipe on laravel 11 / livewire 3 site, as I want to use this https://mary-ui.com/docs/components/image-gallery library.

    I run command

    npm i photoswipe --save


    and in file resources/js/app.js added lines with photoswipe files:

    import './bootstrap';

    import PhotoSwipeLightbox from 'photoswipe/lightbox';
    window.PhotoSwipeLightbox = PhotoSwipeLightbox ;

    import 'photoswipe/dist/photoswipe.css';


    But opening a page with image-gallery :

    <x-mary-image-gallery :images="$currencyImages" class="h-40 rounded-box" />\


    I got error in console of my browser :

    livewire.js?id=923613aa:1120 Alpine Expression Error: PhotoSwipe is not defined

    Expression: "init() {
    const lightbox = new PhotoSwipeLightbox({
    gallery: '#gallery-mary5c504b362297237df4e3762cb5516df6',
    children: 'a',
    showHideAnimationType: 'fade',
    pswpModule: PhotoSwipe
    });

    lightbox.init();
    }"


    What did I miss?

    "laravel/framework": "^11.9",
    "livewire/livewire": "^3.5",
    "livewire/volt": "^1.0",
    "robsontenorio/mary": "^1.35",
    ...

    "dependencies": {
    "photoswipe": "^5.4.4"
    }


    Thanks in advance!

    Continue reading...

Compartilhe esta Página