【发布时间】:2022-03-01 05:05:57
【问题描述】:
所以,我正在使用 laravel 和 tailwind 创建一个项目。 使用 paginate() 方法后,然后在视图中使用此代码
@if ($posts->count())
@foreach ($posts as $post)
<div class="mb-4">
<a class="font-bold" href="">{{ $post->user->name }}</a> <span
class="text-gray-600 text-sm">{{ $post->created_at->diffForHumans() }}</span>
<p class="mb-2">{{ $post->description }}</p>
</div>
@endforeach
{{ $posts->links() }} (this line to create the link to other pages is not working properly)
@else
<p>There are no posts</p>
@endif
【问题讨论】:
-
你在运行
npm run dev吗? -
使用 {{ $posts->links('pagination::semantic-ui') }} 事情会变得更好,但我在使用时没有箭头。
-
所以是设计搞砸了,分页本身有效吗?你检查了分页元素吗?他们是否应用了 Tailwind 类?
-
我试过 npm run dev 和 npm run watch 都没有改变任何东西
-
分页有效。 foreach 有顺风类
标签: laravel tailwind-css