crt设置分页_具有许多出色设置的智能分页

Vue-smart-pagination是一个数据分页组件,它可以将任何数据拆分为页面并提供多种设置。通过NPM安装后,组件全局或局部注册。主要包含PaginationPage和PaginationControl两个组件,分别用于页面内容和控制内容。组件接受props来定制按钮、箭头等样式,数据通过arrayData传递。还支持自定义方法调用和在多个主流浏览器上运行。
摘要由CSDN通过智能技术生成

crt设置分页

Vue智能分页 (Vue-smart-pagination)

A data pagination component that splits any data into pages and has many settings.

数据分页组件,可将任何数据拆分为页面并具有许多设置。

All data is stored in an array and can have any values.

所有数据都存储在数组中,并且可以具有任何值。

vue-smart-pagination

安装 (Installation)

安装NPM软件包。 (Install NPM package.)

$ npm install vue-smart-pagination --save

Register the component globally in your main.js file.

在main.js文件中全局注册该组件。

import { PaginationControl, PaginationPage } from 'vue-smart-pagination'
Vue.component('PaginationControl', PaginationControl)
Vue.component('PaginationPage', PaginationPage)

Or register the component locally in your vue file.

或在vue文件中本地注册组件。

import { PaginationControl, PaginationPage } from 'vue-smart-pagination'
components: {
    PaginationPage,
    PaginationControl
},

用法 (Usage)

Vue-smart-pagination contains two main components:

Vue智能分页包含两个主要组件:

PaginationPage - has content of the pages.

PaginationPage-具有页面内容。

PaginationControl - has content controls.

PaginationControl-具有内容控件。

Both components are registered globally after installing package.

安装软件包后,这两个组件都在全局注册。

Also we have props - :settings="settings” which has two main objects - PaginationControlSettings и PaginationPageSettings.

我们还有道具 - :settings="settings” ,它有两个主要对象PaginationControlSettingsPaginationPageSettings

PaginationControlSettings contains settings related to buttons, arrows, dots and the start page.

PaginationControlSettings包含与按钮,箭头,点和起始页有关的设置。

PaginationPageSettings contains settings related to the page, the spinner and animation of the content change.

PaginationPageSettings包含与页面,微调器和内容更改动画有关的设置。

Array arrayData serves to output data to the page and is required to fill.

Array arrayData用于将数据输出到页面, is required to fill

Example:

例:

<template>
  <div id="app">
    <pagination-page :settings="settings">
      <div slot="page" slot-scope="item">
        <div>{{item.originalEvent.data}}</div>
      </div>
    </pagination-page>
    <pagination-control :settings="settings" />
  </div>
</template>

<script>
import { PaginationControl, PaginationPage } from 'vue-smart-pagination'

export default {
  name: 'App',
  components: {
    PaginationPage,
    PaginationControl
  },
  data: function () {
    return {
      arrayData: [
        {
          data: 'Page № 1'
        },
        {
          data: 'Page № 2'
        },
        {
          data: 'Page № 3'
        },
      ]
    }
  },
  computed: {
    settings: function () {
      return {
        arrayData: this.arrayData
      }
    }
  }
}
</script>

Adding Data to a Component:

向组件添加数据:

In the array arrayData we add data and output them to the <pagination-page>. When referring to an array of elements, specify the originalEvent property to display the current data. To display simple data, use <div>, and for components use <component>.

在数组arrayData我们添加数据并将其输出到<pagination-page> 。 引用元素数组时,请指定originalEvent属性以显示当前数据。 要显示简单数据,请使用<div> ,对于组件请使用<component>

<div slot =" page "slot-scope =" item "> </ div> is required.

<div slot =" page "slot-scope =" item "> </ div>是必需的。

Example:

例:

import testComponent from 'testComponent'

export default {
  components: {
    testComponent
  }
}
arrayData: [
  {
    data: 'apple',
    component: 'testComponent'
  }
]
<pagination-page :settings="settings">
  <div slot="page" slot-scope="item">
    <div>{{item.originalEvent.data}}</div>
    <components :is="item.originalEvent.component"></components>
  </div>
</pagination-page>

To display the pagination buttons, insert the pagination-control component into the template.

要显示分页按钮,请将pagination-control组件插入模板。

Example:

例:

<pagination-control :settings="settings" />

道具 (Props)

NameTypeAll valuesDefault valueDescription
PaginationControlSettings:
Buttons settings:
controlClassString--Common class to the parent block with pagination buttons.
controlStyleStringsquare, circle, defaultdefaultStyle of pagination buttons.
maxButtonsNumber-5The maximum number of pagination buttons on the page.
allpageButtonsStyle
backgroundString-#ffffffBackground color of buttons
borderColorString-#02C8F3Border color of buttons
colorString-#02C8F3Color of buttons
backgroundHoverString-#02C8F3Background color of buttons when hovering
borderColorHoverString-#02C8F3Border color of buttons when hovering
colorHoverString-#ffffffColor of buttons when hovering
fontFamilyString-AvenirFont family of buttons
currentPageButtonStyle
backgroundActiveString-#02C8F3Background color of active button
borderColorActiveString-#02C8F3Border color of active button
colorActiveString-#ffffffColor of active button
Arrows settings:
hideArrowsBooleantrue, falsefalseShow or hide the arrows of pagination.
arrowSwitchHideBooleantrue, falsefalseSwitches the mode of the arrows from disabled to full hiding.
arrowStyleStringstyleArrow-1, styleArrow-2, styleArrow-3styleArrow-2Styles icons of arrow.
arrowStyleColorString-#02C8F3Color of arrow.
arrowStyleColorHoverString-#ffffffColor of arrow when hovering.
Dots settings:
controlDotsStyleStringstyleDots-1, styleDots-2, styleDots-3styleDots-1Styles of dots.
controlDotsColorString-#02C8F3Color of dots.
pageStarted:Number-1Number of start page.
PaginationPageSettings:
Page settings:
pageClassString--Common class for all pages.
Spinner settings:
spinnerBooleantrue, falsefalseShow or hide loading spinner.
spinnerStyleStringspinnerStyle-1, spinnerStyle-2, spinnerStyle-3spinnerStyle-3Styles for loading spinner.
spinnerColorString-#ffffffColor of loading spinner.
Animations settings:
animationPageStringfade, slide, bounce, defaultdefaultAnimation when switching pages.
名称 类型 所有值 默认值 描述
PaginationControlSettings:
按钮设置:
controlClass -- -- 带有分页按钮的父块的通用类。
controlStyle 正方形,圆形,默认 默认 分页按钮的样式。
maxButtons -- 5 页面上的最大分页按钮数。
allpageButtonsStyle
背景 -- #ffffff 按钮的背景色
边框颜色 -- #02C8F3 按钮的边框颜色
颜色 -- #02C8F3 按钮颜色
backgroundHover -- #02C8F3 悬停时按钮的背景色
borderColorHover -- #02C8F3 悬停时按钮的边框颜色
colorHover -- #ffffff 悬停时按钮的颜色
字体系列 -- 阿维尼尔 按钮字体家族
currentPageButtonStyle
backgroundActive -- #02C8F3 活动按钮的背景色
borderColorActive -- #02C8F3 活动按钮的边框颜色
colorActive -- #ffffff 活动按钮的颜色
箭头设置:
hideArrows 布尔型 真假 显示或隐藏分页箭头。
arrowSwitch隐藏 布尔型 真假 将箭头的模式从禁用切换为完全隐藏。
arrowStyle styleArrow-1,styleArrow-2,styleArrow-3 styleArrow-2 样式箭头图标。
arrowStyleColor -- #02C8F3 箭头的颜色。
arrowStyleColorHover -- #ffffff 悬停时箭头的颜色。
点设置:
controlDotsStyle styleDots-1,styleDots-2,styleDots-3 styleDots-1 点的样式。
controlDotsColor -- #02C8F3 点的颜色。
pageStarted: -- 1个 起始页数。
PaginationPageSettings:
页面设置:
pageClass -- -- 所有页面的通用类。
微调器设置:
微调器 布尔型 真假 显示或隐藏加载微调器。
spinnerStyle spinnerStyle-1,spinnerStyle-2,spinnerStyle-3 spinnerStyle-3 加载微调器的样式。
spinnerColor -- #ffffff 加载微调器的颜色。
动画设置:
animationPage 淡入,滑动,弹跳,默认 默认 切换页面时的动画。

方法 (Methods)

To call a custom method, when switching pages, in the <pagination-control /> component in the action callMethod, you must pass a user-defined function that is declared in the methods object.

要在切换页面时调用自定义方法,请在操作callMethod的<pagination-control />组件中传递一个在方法对象中声明的用户定义函数。

Example:

例:

<pagination-control @callMethod =" showText "/>
methods: {
  showText: function (e) {
    console.log (e)
  }
}

浏览器 (Browsers)

Vue-smart-pagination has been successfully tested in browsers such as:

Vue-smart-pagination已在以下浏览器中成功测试:

  • Chrome (66.0)

    Chrome(66.0)

  • Safari (11.1)

    Safari(11.1)

  • Opera (52.0)

    歌剧(52.0)

  • Firefox (59.0.2)

    Firefox(59.0.2)

  • Edge (16)

    边缘(16)

翻译自: https://vuejsexamples.com/a-data-pagination-component-that-splits-any-data-into-pages-and-has-many-settings/

crt设置分页

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值