@@ -21,9 +21,19 @@ const props = withDefaults(defineProps<{
2121 total: number
2222 sizes? : number []
2323 layout? : string
24+ textTemplates? : {
25+ total? : (total : number ) => string
26+ sizes? : (size : number ) => string
27+ jumper? : { before: string , after: string }
28+ }
2429}>(), {
2530 sizes : () => [10 , 20 , 30 , 40 , 50 , 100 ],
2631 layout: ' total, sizes, ->, pager, jumper' ,
32+ textTemplates : () => ({
33+ total : (total : number ) => ` 共 ${total } 条 ` ,
34+ sizes : (size : number ) => ` ${size } 条/页 ` ,
35+ jumper: { before: ' 前往' , after: ' 页' },
36+ }),
2737})
2838
2939const emits = defineEmits <{
@@ -108,15 +118,15 @@ function handleJump() {
108118 <PaginationLast size="icon-sm" class="size-8 rtl:rotate-180 " />
109119 </PaginationContent >
110120 <div v-if =" layoutConfig.total.show" class =" text-sm text-muted-foreground" :style =" { order: layoutConfig.total.order }" >
111- 共 {{ props.total }} 条
121+ {{ props.textTemplates. total?.(props.total) }}
112122 </div >
113123 <div v-if =" layoutConfig.sizes.show" :style =" { order: layoutConfig.sizes.order }" >
114- <Select v-model =" size " :options =" props .sizes .map (size => ({ label: ` ${ size } 条/页 ` , value: size }))" class="w-auto" />
124+ <Select v-model =" size " :options =" props .sizes .map (size => ({ label: props . textTemplates . sizes ?.( size ) ?? ' ' , value: size }))" class="w-auto" />
115125 </div >
116126 <div v-if =" layoutConfig.jumper.show" class =" flex-center gap-2" :style =" { order: layoutConfig.jumper.order }" >
117- <span class =" text-sm text-muted-foreground" >前往 </span >
127+ <span class =" text-sm text-muted-foreground" >{{ props.textTemplates.jumper?.before }} </span >
118128 <Input v-model =" jumpPage " class="h-8 w-16" input-class="text-center" @focus =" handleFocus " @input =" handleInput " @keyup .enter =" handleJump " />
119- <span class =" text-sm text-muted-foreground" >页 </span >
129+ <span class =" text-sm text-muted-foreground" >{{ props.textTemplates.jumper?.after }} </span >
120130 </div >
121131 <div v-if =" layoutConfig['->'].show" class =" flex-1" :style =" { order: layoutConfig['->'].order }" />
122132 </Pagination >
0 commit comments