php - 将组件信息传递给 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);
}
解决方案
推荐阅读
- javascript - 仅仅为了避免索引而使用 Array.map 是否值得?
- r - 我试图取平均值的对象未找到
- wpf - 当 IsDragging = True 时设置 Thumb 的光标
- liquid - 两种不同标签的液体过滤器
- python - Python 列表变异 RGB 值
- javascript - Sapper.js - 预加载 cookie/标题?
- python - 去除具有单引号的列表列表
- python-3.x - 为什么我的基于类的视图没有对我的用户进行身份验证?
- c# - 如何在 C# 表单中访问我的 .txt 文件,我需要 .txt 文件的第一行才能在 TextBox 上打印出来
- python - 当 API Endpoint 的字段名称与具有 Django Rest 框架的模型不同时的嵌套模型