ant-design-vue/components/pagination/demo/custom-changer.md

45 lines
926 B
Markdown
Raw Normal View History

2018-03-10 14:39:12 +00:00
<cn>
#### 自定义下拉选项
自定义下拉选项,例如添加全部选项
</cn>
<us>
#### Custom dropdown options
Customize dropdown options such as adding all options
</us>
2019-10-09 10:32:23 +00:00
```tpl
2018-03-10 14:39:12 +00:00
<template>
<a-pagination
:pageSizeOptions="pageSizeOptions"
:total="total"
showSizeChanger
:pageSize="pageSize"
v-model="current"
@showSizeChange="onShowSizeChange"
>
2019-09-28 12:45:07 +00:00
<template slot="buildOptionText" slot-scope="props">
<span v-if="props.value!=='50'">{{props.value}}条/页</span>
<span v-if="props.value==='50'">全部</span>
</template>
</a-pagination>
2018-03-10 14:39:12 +00:00
</template>
<script>
export default {
data() {
return {
pageSizeOptions: ['10', '20', '30', '40', '50'],
current: 1,
pageSize: 10,
total: 50,
2019-09-28 12:45:07 +00:00
};
2018-03-10 14:39:12 +00:00
},
methods: {
onShowSizeChange(current, pageSize) {
2019-09-28 12:45:07 +00:00
this.pageSize = pageSize;
2018-03-10 14:39:12 +00:00
},
2019-09-28 12:45:07 +00:00
},
};
2018-03-10 14:39:12 +00:00
</script>
```