From 660a41f52158c60dd67861f37db6e7df3b415a35 Mon Sep 17 00:00:00 2001 From: zhipeng xiang <1582505037@qq.com> Date: Fri, 15 Oct 2021 15:08:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Efilters=E5=92=8Csorter?= =?UTF-8?q?=E7=8A=B6=E6=80=81=EF=BC=8C=E7=94=A8=E6=9D=A5=E4=BF=9D=E7=95=99?= =?UTF-8?q?refresh=E6=97=B6=E4=B8=A2=E5=A4=B1=E5=B7=B2=E9=80=89=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E6=8E=92=E5=BA=8Fbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 由于refresh里调用loadData未穿参数,会导致调用时已选的排序等数据在请求查询接口时丢失 --- src/components/Table/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/Table/index.js b/src/components/Table/index.js index d7f2371b7b..831f944251 100644 --- a/src/components/Table/index.js +++ b/src/components/Table/index.js @@ -11,7 +11,11 @@ export default { localLoading: false, localDataSource: [], - localPagination: Object.assign({}, this.pagination) + localPagination: Object.assign({}, this.pagination), + + // 存储表格onchange时的filters, sorter对象 + filters: {}, + sorter: {} } }, props: Object.assign({}, T.props, { @@ -135,7 +139,10 @@ export default { * @param {Object} filters 过滤条件 * @param {Object} sorter 排序条件 */ - loadData (pagination, filters, sorter) { + loadData (pagination, filters = this.filters, sorter = this.sorter) { + this.filters = filters + this.sorter = sorter + this.localLoading = true const parameter = Object.assign({ pageNo: (pagination && pagination.current) ||