laravel分页链接没有点击



感谢您的帮助。分页链接不起作用。页面呈现正确,但尽管链接显示为链接,但单击时不起作用。我的结构如下:如果我在类文件中删除以下引用,则分页有效,但格式不正确。

使用Livewire\WithPaging;使用WithPagination;

类文件:AdminDashboardDirectoryCategoryComponent.php

<?php
namespace AppHttpLivewireAdmin;
use AppModelsDirectoryCategory;
use LivewireComponent;
use LivewireWithPagination;
class AdminDashboardDirectoryCategoryComponent extends Component
{
use WithPagination;
public function render()
{
$dcategories = DirectoryCategory::paginate(9);
return view('livewire.admin.admin-dashboard-directory-category-component',['dcategories'=>$dcategories])->layout('frontend_layout.index2');
}
}

查看文件:admin-dashboard-directory-category-component.blad.php

style>
nav svg {
height: 20px;
}
nav .hidden {
display: block !important;
}
</style>
<section class="content-central">
<div class="content_info">
<div class="paddings-mini">
<div class="container">
<div class="row portfolioContainer">
<div class="col-md-12">
<table class="table table-striped tester1">
<thead>
<tr>
<th>#</th>
<th>Image</th>
<th>Group</th>
<th>Title</th>
<th>Slug</th>

</thead>
<tbody>
@foreach($dcategories as $dcategory)
<tr>
<td>{{$dcategory->id}}</td>
<td><img src="{{asset('frontend/assets/images/dir_categories')}}/{{$dcategory->category_image}}" width="60" /></td>
<td>{{$dcategory->category_group}}</td>
<td>{{$dcategory->category_title}}</td>
<td>{{$dcategory->category_slug}}</td>

</tr>
@endforeach
</tbody>
</table>
{{$dcategories->links()}}

</div>
</div>
</div>
</div>
</div>
</section>
</body>
</html>

https://laravel-livewire.com/docs/2.x/pagination

当使用任一方法时,而不是在分页中使用锚标记组件,您应该使用具有以下内容的wire:click处理程序方法:

next导航到下一页的页面

previous导航到上一页的页面

gotoPage($page(可导航到特定页面。

您缺少这些方法。

  1. 您可以添加使用引导分页主题。

    protected$paginationTheme='bootstrap';

  2. 调用所有数据库。

    $dcategories=目录类别::all((->繁殖(9(;

相关内容

  • 没有找到相关文章

最新更新