You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ant-design-vue/components/pagination/demo/changer.vue

63 lines
1.1 KiB

<docs>
---
order: 2
title:
zh-CN: 改变
en-US: Changer
---
## zh-CN
改变每页显示条目数
## en-US
Change `pageSize`.
</docs>
<template>
<div>
<a-pagination
v-model:current="current1"
v-model:pageSize="pageSize"
show-size-changer
:total="500"
@showSizeChange="onShowSizeChange"
/>
<br />
<a-pagination
v-model:current="current2"
show-size-changer
:total="500"
disabled
@showSizeChange="onShowSizeChange"
/>
</div>
</template>
<script lang="ts">
import { defineComponent, ref, watch } from 'vue';
export default defineComponent({
setup() {
const pageSize = ref(20);
const current1 = ref(3);
const current2 = ref(4);
const onShowSizeChange = (current: number, pageSize: number) => {
console.log(current, pageSize);
};
watch(pageSize, () => {
console.log('pageSize', pageSize.value);
});
watch(current1, () => {
console.log('current', current1.value);
});
return {
pageSize,
current1,
current2,
onShowSizeChange,
};
},
});
</script>