【问题标题】:Modal created with livewire-ui/modal doesn't close使用 livewire-ui/modal 创建的模态不会关闭
【发布时间】:2021-07-19 06:12:06
【问题描述】:

我正在检查livewire-ui/modal,如this github page中所述

当点击打开按钮时,模式会正确显示,但它从不关闭无论使用的意思是什么,例如:

  • 点击离开
  • 使用转义触摸
  • 在此代码中使用关闭按钮
<button wire:click="$emit('closeModal')">No, do not delete</button>
  • 在此代码中使用关闭按钮
<button class="button-link" wire:click.prevent="close()"> Poster</button>

并且在模态中具有这样的关闭功能:

<?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();
    }
}

【问题讨论】:

  • 浏览器控制台报错了吗?

标签: laravel-8 laravel-livewire


【解决方案1】:

功能是由于我在页面中有 2 个 alpine 一个直接在页面 (CDN) 中,另一个在 app.js 中(需要“alpinejs”)。我只是保留了 require 'alpinejs',现在它可以工作了。

【讨论】:

    猜你喜欢
    • 2020-09-21
    • 2020-12-01
    • 2015-06-05
    • 1970-01-01
    • 1970-01-01
    • 2021-05-10
    • 2020-06-06
    • 2018-01-06
    • 1970-01-01
    相关资源
    最近更新 更多