提交 528d847f 编写于 作者: P piexlmax

增加getTableData的请求发起前后钩子

上级 e48edea7
...@@ -44,14 +44,18 @@ export default { ...@@ -44,14 +44,18 @@ export default {
this.page = val this.page = val
this.getTableData() this.getTableData()
}, },
async getTableData(page = this.page, pageSize = this.pageSize) { // @params beforeFunc function 请求发起前执行的函数 默认为空函数
const table = await this.listApi({ page, pageSize, ...this.searchInfo }) // @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) { if (table.code === 0) {
this.tableData = table.data.list this.tableData = table.data.list
this.total = table.data.total this.total = table.data.total
this.page = table.data.page this.page = table.data.page
this.pageSize = table.data.pageSize this.pageSize = table.data.pageSize
} }
afterFunc()
} }
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册