发射后 Livewire 组件不会完全刷新

时间:2021-07-18 14:26:20

标签: laravel laravel-livewire

livewire 组件在从另一个组件发出后不会完全刷新,它显示了一些缺失的部分。有没有办法解决这个问题?

enter image description here

我的 livewire 组件

    class AllStaffs extends Component
{
    // public $staffs;
    use WithPagination;
    protected $listeners = ['addedStaff' => 'render',
        'editedStaff' => 'render',
        'render'];

    public function delete($id)
    {
        User::destroy($id);
        $this->emitSelf('render');
        $this->dispatchBrowserEvent('staff-deleted');
        session()->flash('success', 'Staff Deleted Successfully ?!');
    }

    public function render()
    {
        $roles = Role::all();
        $staffs = User::latest()->paginate(10);
        // $staffs = $this->staffs;
        return view('livewire.all-staffs', compact('staffs', 'roles'));
    }
}

1 个答案:

答案 0 :(得分:0)

我使用 livewire 文档的故障排除部分解决了它 在每张桌子上设置电线钥匙 线:key="foo"