首页 > 解决方案 > 将组件信息传递给 livewire 中的另一个

问题描述

我在 2 个不同的页面上有 2 个组件,我想向其中一个传递一些信息但它没有出来,有人可以帮我看看我做错了什么

组件e1(刀片)



<button wire:click="edit({{ $doc->id }})" type="button" class="px-6 py-4 text-blue-600 hover:text-blue-900">Editar</button>


Componente1(类控制器)


public function edit($id){
        $this->emit('edit_documento',$id);
        return redirect()->to('/store-documentos');
    }

Componente2(类控制器)

protected $listeners = ['edit_documento'];


    public function edit_documento($id=Null)
    {
        dd($id);
        
    }

标签: phplaravel-livewire

解决方案


推荐阅读