vue 分页组件_使用CSS框架tailwindcss构建的vue分页组件

vue-ads-pagination是一个基于Vue.js的分页组件,采用tailwindcss库进行样式设计。组件左侧显示页面信息,右侧提供选择特定、首、末、前后页的功能。可以通过npm或yarn进行安装,并在项目中使用。测试使用jest框架进行,如果有问题或需求,可以在项目中提出。
摘要由CSDN通过智能技术生成

vue 分页组件

vue-ads分页 (vue-ads-pagination)

Vue ads pagination is a vue js pagination component. On the left side you find some information about the shown items.

Vue广告分页是vue js分页组件。 在左侧,您可以找到有关所示项目的一些信息。

On the right side you can select a specific, the first, last, next or previous page.

在右侧,您可以选择特定页面,第一页,最后一页,下一页或上一页。

It uses the handy tailwind css library for styling.

它使用方便的顺风CSS库进行样式设置。

安装 (Installation)

You can install the package via npm or yarn.

您可以通过npm或yarn安装软件包。

NPM (NPM)

npm install vue-ads-pagination --save

npm install vue-ads-pagination --save

(YARN)

yarn add vue-ads-pagination

yarn add vue-ads-pagination

用法 (Usage)

You can use the vue-ads-pagination component by using the following code in your project.

您可以通过在项目中使用以下代码来使用vue-ads-pagination组件。

<template>
  <div id="app">
    <vue-ads-pagination
        :page="3"
        :itemsPerPage="10"
        :maxVisiblePages="4"
        :totalItems="200"
        @pageChange="pageChange"
    />
  </div>
</template>

<script>
import VueAdsPagination from 'vue-ads-pagination';

export default {
    name: 'app',
    components: {
        VueAdsPagination,
    },

    methods: {
        pageChange (page, range) {
            console.log(page, range);
        },
    },
};
</script>

物产 (Properties)

propertyrequireddefaultdescription
pagefalse0A zero-based number to set the initial page
itemsPerPagefalse10The max amount of items on one page
maxVisiblePagesfalse5The number of pages to be visible if their are too many pages
totalItemstrueThe total amount of items
属性 需要 默认 描述
0 从零开始的数字以设置初始页面
每页项目 10 一页上的最大项目数
maxVisiblePages 5 页面过多时可见的页面数
totalItems 真正 项目总数

方法 (Methods)

methodparametersdescription
pageChangepage, rangeEmitted on creation, to know the initial state, and if another page is clicked. Two parameters are given: The zero-based page and the range. This is an object that contain the start and end keys. They contain a zero-based number to identify the items to be shown.
方法 参数 描述
pageChange 页面,范围 在创建时发出,以了解初始状态以及是否单击了另一个页面。 给出两个参数:从零开始的页面和范围。 这是一个包含开始和结束键的对象。 它们包含一个从零开始的数字,以标识要显示的项目。

测试中 (Testing)

We use the jest framework for testing this pagination component. Run the following command to test it:

我们使用jest框架来测试此分页组件。 运行以下命令进行测试:

npm run test:unit

问题 (Issues)

If you have any issues (bugs, features, ...) on the current project, add them here.

如果您在当前项目中有任何问题(错误,功能...),请在此处添加。

翻译自: https://vuejsexamples.com/a-vue-pagination-component-build-with-the-css-framework-tailwindcss/

vue 分页组件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值