Skip to content

翻页器 xPagination


在线预览
在线模拟尺寸:

介绍

复杂和简便两种模式

平台兼容

H5andriodIOS小程序UTSUNIAPP-X SDKversion
☑️☑️☑️☑️4.44+1.1.9

文件路径

ts

@/uni_modules/tmx-ui/components/x-pagination/x-pagination.uvue

使用

ts

<x-pagination></x-pagination>

Props 属性

名称说明类型默认值
modelValue当前页码number1
disabled是否彬booleanfalse
pageSize每页的数量number10
total总条数number0
maxButtons中间显示最多页码数量<br>注意它不是只整体页码是指多的时候中间的数量<br>如果不能理解请根据demo查看。number3
minButtons最小显示数量<br>如果总页小于此值,直接输出所有页码,上方的maxButtons失效。number5
showTotal是否显示总数(当simple开启时有效)booleanfalse
color当前默认背景string"#f5f5f5"
darkColor暗黑时如果空值取sheet暗黑背景string""
activeColor选中时的按钮背景,如果空值取全局colorstring""
btnWidth按钮宽,这里是最小宽string"38"
btnHeight按钮高string"38"
fontSize字号string"14"
fontColor字号颜色string"#333333"
fontDarkColor暗黑时的字号颜色string"#ffffff"
activeFontColor激活时字号颜色string"#FFFFFF"
activeFontDarkColor激活时暗黑的字号颜色string"#ffffff"
round按钮圆角string"6"
simple是否开启简单型模式。booleanfalse

Events 事件

名称参数说明
change-页码切换时触发
@@param {number} current 当前页码
update:modelValue--

Slots 插槽

名称说明数据

Ref 方法

名称参数返回值说明

示例文件路径

json

/pages/daohang/pagination

示例源码

uvue
vue
<template>
	<!-- #ifdef APP -->
	<scroll-view style="flex:1">
	<!-- #endif -->
	<!-- #ifdef MP-WEIXIN -->
	<page-meta :page-style="`background-color:${xThemeConfigBgColor}`">
		<navigation-bar :background-color="xThemeConfigNavBgColor" :front-color="xThemeConfigNavFontColor"></navigation-bar>
	</page-meta>
	<!-- #endif -->
	
		<x-sheet>
			<x-text font-size="18" class=" text-weight-b mb-8">翻页器 xPagination</x-text>
			<x-text color="#999999" class="text-size-b mb-20">
				提供简单和复杂两种类型
			</x-text>
			<x-pagination v-model="current as number" :total="1000" @change="pageChange"></x-pagination>
		</x-sheet>
	
		<x-sheet >
			<x-text font-size="18" class=" text-weight-b mb-20">自定中间按钮最小数量</x-text>
			<x-pagination :total="50" :max-buttons="2"></x-pagination>
		</x-sheet>
		<x-sheet >
			<x-text font-size="18" class=" text-weight-b mb-20">简单型</x-text>
			<x-pagination :simple="true" :total="1000" :max-buttons="2"></x-pagination>
		</x-sheet>
	<!-- #ifdef APP -->
	</scroll-view>
	<!-- #endif -->
</template>

<script setup>
	import {ref} from "vue"
	const current = ref<number>(5)
	const pageChange = (index:number)=>{
		console.log("页码",index)
	}
	
</script>

<style>
		
</style>
最近更新