From 528d847fb6c6d3bcbd484e0e68e093f328173d6c Mon Sep 17 00:00:00 2001 From: piexlmax Date: Tue, 7 Sep 2021 15:11:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0getTableData=E7=9A=84?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=8F=91=E8=B5=B7=E5=89=8D=E5=90=8E=E9=92=A9?= =?UTF-8?q?=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/mixins/infoList.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web/src/mixins/infoList.js b/web/src/mixins/infoList.js index b57e3a09..ff1b219f 100644 --- a/web/src/mixins/infoList.js +++ b/web/src/mixins/infoList.js @@ -44,14 +44,18 @@ export default { this.page = val this.getTableData() }, - async getTableData(page = this.page, pageSize = this.pageSize) { - const table = await this.listApi({ page, pageSize, ...this.searchInfo }) + // @params beforeFunc function 请求发起前执行的函数 默认为空函数 + // @params afterFunc function 请求完成后执行的函数 默认为空函数 + async getTableData(beforeFunc = () => {}, afterFunc = () => {}) { + beforeFunc() + const table = await this.listApi({ page: this.page, pageSize: this.pageSize, ...this.searchInfo }) if (table.code === 0) { this.tableData = table.data.list this.total = table.data.total this.page = table.data.page this.pageSize = table.data.pageSize } + afterFunc() } } }