From 55c73cd855af99b3d98173a73cc69bee2b900e2a Mon Sep 17 00:00:00 2001 From: hooray <304327508@qq.com> Date: Sat, 17 Oct 2020 16:03:56 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4mixins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mixins/pagination.js | 48 ---------------------------------------- 1 file changed, 48 deletions(-) delete mode 100644 src/mixins/pagination.js diff --git a/src/mixins/pagination.js b/src/mixins/pagination.js deleted file mode 100644 index f7e2309a..00000000 --- a/src/mixins/pagination.js +++ /dev/null @@ -1,48 +0,0 @@ -export default { - data() { - return { - loading: false, - sort: null, - order: null, - pagination: { - page: 1, - size: 10, - total: 0, - sizes: [10, 20, 50, 100], - layout: 'total, sizes, ->, prev, pager, next, jumper' - } - } - }, - methods: { - getParams(params = {}) { - const baseParams = { - from: (this.pagination.page - 1) * this.pagination.size, - limit: this.pagination.size - } - if (this.sort && this.order) { - baseParams.sort = this.sort - baseParams.order = this.order - } - Object.assign(baseParams, params) - return baseParams - }, - onSizeChange(size) { - this.pagination.size = size - this.getDataList() - }, - onCurrentChange(page) { - this.pagination.page = page - this.getDataList() - }, - onSortChange(params) { - if (params.order) { - this.sort = params.prop - this.order = params.order === 'ascending' ? 'asc' : 'desc' - } else { - this.sort = null - this.order = null - } - this.getDataList() - } - } -}