mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 09:50:58 +08:00
82 lines
2.1 KiB
Vue
82 lines
2.1 KiB
Vue
|
<template>
|
||
|
<div class="demo-pagination-block">
|
||
|
<span class="demonstration">Total item count</span>
|
||
|
<el-pagination
|
||
|
v-model:currentPage="currentPage1"
|
||
|
:page-size="100"
|
||
|
layout="total, prev, pager, next"
|
||
|
:total="1000"
|
||
|
@size-change="handleSizeChange"
|
||
|
@current-change="handleCurrentChange"
|
||
|
>
|
||
|
</el-pagination>
|
||
|
</div>
|
||
|
<div class="demo-pagination-block">
|
||
|
<span class="demonstration">Change page size</span>
|
||
|
<el-pagination
|
||
|
v-model:currentPage="currentPage2"
|
||
|
:page-sizes="[100, 200, 300, 400]"
|
||
|
:page-size="100"
|
||
|
layout="sizes, prev, pager, next"
|
||
|
:total="1000"
|
||
|
@size-change="handleSizeChange"
|
||
|
@current-change="handleCurrentChange"
|
||
|
>
|
||
|
</el-pagination>
|
||
|
</div>
|
||
|
<div class="demo-pagination-block">
|
||
|
<span class="demonstration">Jump to</span>
|
||
|
<el-pagination
|
||
|
v-model:currentPage="currentPage3"
|
||
|
:page-size="100"
|
||
|
layout="prev, pager, next, jumper"
|
||
|
:total="1000"
|
||
|
@size-change="handleSizeChange"
|
||
|
@current-change="handleCurrentChange"
|
||
|
>
|
||
|
</el-pagination>
|
||
|
</div>
|
||
|
<div class="demo-pagination-block">
|
||
|
<span class="demonstration">All combined</span>
|
||
|
<el-pagination
|
||
|
v-model:currentPage="currentPage4"
|
||
|
:page-sizes="[100, 200, 300, 400]"
|
||
|
:page-size="100"
|
||
|
layout="total, sizes, prev, pager, next, jumper"
|
||
|
:total="400"
|
||
|
@size-change="handleSizeChange"
|
||
|
@current-change="handleCurrentChange"
|
||
|
>
|
||
|
</el-pagination>
|
||
|
</div>
|
||
|
</template>
|
||
|
<script lang="ts">
|
||
|
import { defineComponent, ref } from 'vue'
|
||
|
|
||
|
export default defineComponent({
|
||
|
setup() {
|
||
|
const handleSizeChange = (val) => {
|
||
|
console.log(`${val} items per page`)
|
||
|
}
|
||
|
const handleCurrentChange = (val) => {
|
||
|
console.log(`current page: ${val}`)
|
||
|
}
|
||
|
|
||
|
return {
|
||
|
currentPage1: ref(5),
|
||
|
currentPage2: ref(5),
|
||
|
currentPage3: ref(5),
|
||
|
currentPage4: ref(4),
|
||
|
handleSizeChange,
|
||
|
handleCurrentChange,
|
||
|
}
|
||
|
},
|
||
|
})
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss" scoped>
|
||
|
.demo-pagination-block + .demo-pagination-block {
|
||
|
margin-top: 10px;
|
||
|
}
|
||
|
</style>
|