1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <template>
- <div class="pagination-box">
- <el-pagination
- hide-on-single-page
- @current-change="handleCurrentChange"
- :current-page="currentPage"
- :page-size="pageSize"
- layout="total, prev, pager, next"
- :total="total">
- </el-pagination>
- </div>
- </template>
- <script>
- export default {
- components: {},
- props: {
- total: { type: Number, default: 0 },
- pageSize: { type: Number, default: 10 }
- },
- data() {
- return {
- currentPage: 1
- };
- },
- computed: {},
- mounted() {},
- methods: {
- handleCurrentChange(e) {
- this.currentPage = e > 0 ? e - 1 : 0;
- this.$emit('query', { paging: { page: this.currentPage, size: this.pageSize } });
- },
- resetPage(e) {
- if (e == -1) {
- this.currentPage = 0;
- } else {
- this.currentPage = Math.ceil(this.total / this.pageSize);
- }
- this.$emit('query', { page: this.currentPage, size: this.pageSize });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .pagination-box {
- margin-top: 10px;
- }
- </style>
|