ant-design-vue/components/pagination/demo/custom-changer.vue
Cherry7 9be58078d2
Refactor(demo): change options to composition api (#6499)
* feat(demo): A-B

* feat(demo): update B-checkbox

* feat(demo): update CheckBox -DatePicker

* feat(demo): update DatePicker - Form

* feat(demo): update Form - List

* feat(demo): update  List-pagination

* feat(demo): update  List - skeleton

* feat(demo): update  skeleton - switch

* feat(demo): update  skeleton - switch

* feat(demo): update   switch - upload

* feat(demo): update  watermark

* fix(demo): del hashId
2023-04-28 14:08:21 +08:00

45 lines
983 B
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<docs>
---
order: 3
title:
zh-CN: 自定义下拉选项
en-US: Custom dropdown options
---
## zh-CN
自定义下拉选项例如添加全部选项
## en-US
Customize dropdown options such as adding all options
</docs>
<template>
<a-pagination
v-model:current="current"
v-model:page-size="pageSizeRef"
:page-size-options="pageSizeOptions"
:total="total"
show-size-changer
@showSizeChange="onShowSizeChange"
>
<template #buildOptionText="props">
<span v-if="props.value !== '50'">{{ props.value }}/</span>
<span v-else>全部</span>
</template>
</a-pagination>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
const pageSizeOptions = ref<string[]>(['10', '20', '30', '40', '50']);
const current = ref(1);
const pageSizeRef = ref(10);
const total = ref(50);
const onShowSizeChange = (current: number, pageSize: number) => {
console.log(current, pageSize);
pageSizeRef.value = pageSize;
};
</script>