Skip to content

xtf-pagination

组件说明

xtf-pagination 是分页导航组件,适用于列表和数据表的页码切换;支持页码列表、跳页与每页条数切换。 核心能力以当前 xtf-pagination.vue 源码为准。


基础用法

1. 基础用法

最小配置下即可完成常见业务交互:

vue
<template>
  <xtf-pagination v-model="value" :total="100" @change="onEvent" />
</template>

<script>
export default {
  data() {
    return { value: '' }
  },
  methods: {
    onEvent(payload) {
      console.log('组件事件', payload)
    }
  }
}
</script>

2. 核心交互

监听组件事件并维护页面状态:

vue
<template>
  <xtf-pagination
    v-model="value"
    show-page-list
    show-jumper
    :total="200"
    :page-size="10"
    @page-size-change="onEvent"
  />
</template>

<script>
export default {
  data() {
    return { value: '' }
  },
  methods: {
    onEvent(payload) {
      console.log('组件事件', payload)
    }
  }
}
</script>

3. 进阶配置

组合布局、样式或插槽能力:

vue
<template>
  <xtf-pagination v-model="value" variant="outline" show-page-list :total="80" :page-size="10" />
</template>

<script>
export default {
  data() {
    return { value: '' }
  },
  methods: {
    onEvent(payload) {
      console.log('组件事件', payload)
    }
  }
}
</script>

全部属性

属性类型默认值作用描述适用范围
modelValue[String, Number]undefined控制组件的 modelValue 行为。按业务需要设置。
value[String, Number]undefined控制组件的 value 行为。按业务需要设置。
current[String, Number]1控制组件的 current 行为。按业务需要设置。
pageSize[String, Number]10控制组件的 pageSize 行为。按业务需要设置。
total[String, Number]0控制组件的 total 行为。按业务需要设置。
pageCount[String, Number]0控制组件的 pageCount 行为。按业务需要设置。
pageSizeOptionsArray函数返回值控制组件的 pageSizeOptions 行为。按业务需要设置。
modeString'full'控制组件的 mode 行为。按业务需要设置。
prevTextString''控制组件的 prevText 行为。按业务需要设置。
nextTextString''控制组件的 nextText 行为。按业务需要设置。
showJumperBooleanfalse控制组件的 showJumper 行为。按业务需要设置。
showPageListBooleanfalse控制组件的 showPageList 行为。按业务需要设置。
showTotalBooleantrue控制组件的 showTotal 行为。按业务需要设置。
pageButtonCount[String, Number]5控制组件的 pageButtonCount 行为。按业务需要设置。
pageStyle[String, Object]''控制组件的 pageStyle 行为。按业务需要设置。
activePageStyle[String, Object]''控制组件的 activePageStyle 行为。按业务需要设置。
pageShapeString'rounded'控制组件的 pageShape 行为。按业务需要设置。
variantString'default'控制组件的 variant 行为。按业务需要设置。
disabledBooleanfalse控制组件的 disabled 行为。按业务需要设置。
customClassString''控制组件的 customClass 行为。按业务需要设置。
customStyle[String, Object]''控制组件的 customStyle 行为。按业务需要设置。

事件

事件名称触发时机回调参数参数说明
input对应交互或状态变化时触发。payload参数形状以源码 $emit('input', ...) 为准。
update:modelValue页码变化时触发。page新的当前页码,供 v-model 同步。
update:value对应交互或状态变化时触发。payload参数形状以源码 $emit('update:value', ...) 为准。
update:current对应交互或状态变化时触发。payload参数形状以源码 $emit('update:current', ...) 为准。
update:pageSize对应交互或状态变化时触发。payload参数形状以源码 $emit('update:pageSize', ...) 为准。
change对应交互或状态变化时触发。payload参数形状以源码 $emit('change', ...) 为准。
page-size-change对应交互或状态变化时触发。payload参数形状以源码 $emit('page-size-change', ...) 为准。

事件使用示例

vue
<template>
  <xtf-pagination :total="100" @input="onEvent" />
</template>
<script>
export default {
  methods: {
    onEvent(payload) {
      console.log('收到事件', payload)
    }
  }
}
</script>

方法

无公开实例方法,通过双向绑定和 change 事件控制。


主题说明

  • var(--xtf-color-surface) 参与组件的颜色、背景、边框或动效呈现。
  • var(--xtf-card-border) 参与组件的颜色、背景、边框或动效呈现。
  • var(--xtf-color-fill) 参与组件的颜色、背景、边框或动效呈现。
  • var(--xtf-color-text) 参与组件的颜色、背景、边框或动效呈现。
  • var(--xtf-color-primary) 参与组件的颜色、背景、边框或动效呈现。
  • var(--xtf-color-text-secondary) 参与组件的颜色、背景、边框或动效呈现。
  • var(--xtf-radius-md) 参与组件的颜色、背景、边框或动效呈现。
  • 视觉变体的可选值以 variantthemelayout 等属性在源码中的分支为准。

如需全局调整主题,请在 xtf-config-provider 或主题配置中覆盖上述 CSS 变量。

MIT Licensed