@2alheure/vue-pagination 中文文档教程

发布于 3年前 浏览 24 项目主页 更新于 3年前

Vue.js Pagination

一个简单的 Vue.js 组件,有助于打印和处理分页。
此组件与 Vue 3 兼容。

Installation

首先,您必须运行 npm install @2alheure/vue-pagination
然后,您可以使用 import Pagination from "@2alheure/vue-pagination"; 导入它。

Usage

用两件事调用组件:

  • a v-model directive, using a variable representing the active page (integer)
  • a maxPage prop (integer) representing the max page number

Example

<Pagination v-model="page" :maxPage="10" />

<script>
  import Pagination from "@2alheure/vue-pagination";

  export default {
    components: {
      Pagination
    },
    data() {
      return {
        page: 3
      }
    }
  };
</script>

Props

NameTypeDefault valueDescription
modelValueNumbernoneThe prop linked to the v-model directive (mandatory).
maxPageNumbernoneThe maximum number of pages (mandatory).
textColorString#4a5568The color of the buttons' text.
backgroundColorString#fffThe color of the buttons' background.
borderColorString#e2e8f0The color of the buttons' borders.
selectedTextColorString#f7fafcThe color of the text for the selected button.
selectedBackgroundColorString#4a5568The color of the background for the selected button.
selectedBorderColorString#e2e8f0The color of the borders for the selected button.
hoverTextColorString#f7fafcThe color of the text for the hovered button.
hoverBackgroundColorString#a0aec0The color of the background for the hovered button.
hoverBorderColorString#e2e8f0The color of the borders for the hovered button.
controlsHoverBorderColorString#cbd5e0The color of the borders for the hovered "Previous" or "Next" buttons.

Events

NameValue typeValueDescription
update:modelValueNumberThe page clickedEmitted each time the page changes
prevNumberThe previous page numberEmitted when the "Previous" button is clicked
nextNumberThe next page numberEmitted when the "Next" button is clicked

Vue.js Pagination

A simple Vue.js component that helps to print and handle a pagination.
This component is compatible with Vue 3.

Installation

First, you must run npm install @2alheure/vue-pagination.
Then, you can import it with import Pagination from "@2alheure/vue-pagination";.

Usage

Call the component with two things:

  • a v-model directive, using a variable representing the active page (integer)
  • a maxPage prop (integer) representing the max page number

Example

<Pagination v-model="page" :maxPage="10" />

<script>
  import Pagination from "@2alheure/vue-pagination";

  export default {
    components: {
      Pagination
    },
    data() {
      return {
        page: 3
      }
    }
  };
</script>

Props

NameTypeDefault valueDescription
modelValueNumbernoneThe prop linked to the v-model directive (mandatory).
maxPageNumbernoneThe maximum number of pages (mandatory).
textColorString#4a5568The color of the buttons' text.
backgroundColorString#fffThe color of the buttons' background.
borderColorString#e2e8f0The color of the buttons' borders.
selectedTextColorString#f7fafcThe color of the text for the selected button.
selectedBackgroundColorString#4a5568The color of the background for the selected button.
selectedBorderColorString#e2e8f0The color of the borders for the selected button.
hoverTextColorString#f7fafcThe color of the text for the hovered button.
hoverBackgroundColorString#a0aec0The color of the background for the hovered button.
hoverBorderColorString#e2e8f0The color of the borders for the hovered button.
controlsHoverBorderColorString#cbd5e0The color of the borders for the hovered "Previous" or "Next" buttons.

Events

NameValue typeValueDescription
update:modelValueNumberThe page clickedEmitted each time the page changes
prevNumberThe previous page numberEmitted when the "Previous" button is clicked
nextNumberThe next page numberEmitted when the "Next" button is clicked
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文