承接 mrshanebarron/pagination 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mrshanebarron/pagination

Composer 安装命令:

composer require mrshanebarron/pagination

包简介

Pagination component for Laravel - supports Livewire and Vue

README 文档

README

A pagination component for Laravel applications. Displays page numbers with navigation controls. Works with Livewire and Vue 3.

Installation

composer require mrshanebarron/pagination

Livewire Usage

Basic Usage

<livewire:sb-pagination
    wire:model="page"
    :total-pages="10"
/>

With Item Count

<livewire:sb-pagination
    wire:model="page"
    :total-pages="15"
    :per-page="20"
    :total="300"
    :show-info="true"
/>

Livewire Props

Prop Type Default Description
wire:model number 1 Current page number
total-pages number required Total number of pages
per-page number 10 Items per page
total number 0 Total item count
on-each-side number 2 Pages shown on each side
show-info boolean true Show "Showing X to Y of Z"

Vue 3 Usage

Setup

import { SbPagination } from './vendor/sb-pagination';
app.component('SbPagination', SbPagination);

Basic Usage

<template>
  <SbPagination
    v-model="currentPage"
    :total-pages="totalPages"
  />
</template>

<script setup>
import { ref } from 'vue';
const currentPage = ref(1);
const totalPages = 10;
</script>

With Results Info

<template>
  <SbPagination
    v-model="currentPage"
    :total-pages="totalPages"
    :per-page="perPage"
    :total="totalItems"
    show-info
  />
</template>

<script setup>
import { ref, computed } from 'vue';

const currentPage = ref(1);
const perPage = 20;
const totalItems = 157;
const totalPages = computed(() => Math.ceil(totalItems / perPage));
</script>

Data Table Example

<template>
  <div>
    <!-- Table -->
    <table class="w-full">
      <thead>
        <tr>
          <th>Name</th>
          <th>Email</th>
        </tr>
      </thead>
      <tbody>
        <tr v-for="user in paginatedUsers" :key="user.id">
          <td>{{ user.name }}</td>
          <td>{{ user.email }}</td>
        </tr>
      </tbody>
    </table>

    <!-- Pagination -->
    <div class="mt-4">
      <SbPagination
        v-model="currentPage"
        :total-pages="totalPages"
        :per-page="perPage"
        :total="users.length"
        @update:model-value="fetchPage"
      />
    </div>
  </div>
</template>

<script setup>
import { ref, computed } from 'vue';

const currentPage = ref(1);
const perPage = 10;
const users = ref([]); // Your data

const totalPages = computed(() => Math.ceil(users.value.length / perPage));

const paginatedUsers = computed(() => {
  const start = (currentPage.value - 1) * perPage;
  return users.value.slice(start, start + perPage);
});

const fetchPage = (page) => {
  // Fetch data for new page
};
</script>

Custom Visible Pages

<template>
  <!-- Show more page numbers -->
  <SbPagination
    v-model="page"
    :total-pages="100"
    :on-each-side="3"
  />

  <!-- Show fewer page numbers -->
  <SbPagination
    v-model="page"
    :total-pages="100"
    :on-each-side="1"
  />
</template>

Vue Props

Prop Type Default Description
modelValue Number 1 Current page (v-model)
totalPages Number required Total page count
perPage Number 10 Items per page (for info)
total Number 0 Total items (for info)
onEachSide Number 2 Visible pages each side
showInfo Boolean true Show results info text

Events

Event Payload Description
update:modelValue number Emitted when page changes

Features

  • Page Numbers: Shows current page with neighbors
  • Ellipsis: Shows ... for skipped ranges
  • First/Last: Always shows first and last page
  • Navigation: Previous/next buttons
  • Results Info: "Showing X to Y of Z results"

Page Display Logic

With onEachSide: 2 and 20 total pages:

  • Page 1: 1 2 3 ... 20
  • Page 5: 1 ... 3 4 5 6 7 ... 20
  • Page 20: 1 ... 18 19 20

Styling

Uses Tailwind CSS:

  • White buttons with border
  • Blue background for current page
  • Disabled state for first/last page
  • Hover effects

Requirements

  • PHP 8.1+
  • Laravel 10, 11, or 12
  • Tailwind CSS 3.x

License

MIT License

mrshanebarron/pagination 适用场景与选型建议

mrshanebarron/pagination 是一款 基于 Vue 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「pager」 「pagination」 「laravel」 「vue」 「livewire」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 mrshanebarron/pagination 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 mrshanebarron/pagination 我们能提供哪些服务?
定制开发 / 二次开发

基于 mrshanebarron/pagination 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 13
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 22
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-14