Skip to content

Commit

Permalink
新增filters和sorter状态,用来保留refresh时丢失已选筛选排序bug
Browse files Browse the repository at this point in the history
由于refresh里调用loadData未穿参数,会导致调用时已选的排序等数据在请求查询接口时丢失
  • Loading branch information
xiangzp authored and sendya committed Nov 25, 2021
1 parent 47cc069 commit 660a41f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/Table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down Expand Up @@ -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) ||
Expand Down

0 comments on commit 660a41f

Please sign in to comment.