【发布时间】:2021-01-28 14:59:27
【问题描述】:
我在 Laravel Livewire 中有一个非常简单的表格
<table class="table-auto w-full">
<thead>
<tr>
<th class="px-4 py-2">Id</th>
<th class="px-4 py-2">Name</th>
<th class="px-4 py-2">Age</th>
<th class="px-4 py-2">Action</th>
</tr>
@foreach($students as $student)
<tr>
<td class="border px-4 py-2">{{$student->id}}</td>
<td class="border px-4 py-2">{{$student->name}}</td>
<td class="border px-4 py-2">{{$student->age}}</td>
<td class="border px-4 py-2">
<x-jet-danger-button wire:click="confirmItemDeletion( {{ $student->id}})" wire:loading.attr="disabled">
Delete
</x-jet-danger-button>
</td>
<tr>
@endforeach
</tbody>
</table>
删除按钮也可以使用。 我想打开另一个模型以在行单击时进行编辑,而删除按钮也应该可以工作。
我尝试在所有代码中添加此代码,但它可以正常工作,但
<td class="border px-4 py-2" wire:click="confirmItemEdit( {{ $item->id}})">{{$student->id}}</td>
- 不显示链接光标。为了得到这个,我把这个风格放在
<tr style="cursor: pointer;"> - 还有不写wire的方法:点击每个
谢谢
【问题讨论】: