File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,7 @@ export default {
112
112
)
113
113
)
114
114
115
+ // 对接自己的通用数据接口需要修改下方代码中的 r.pageNo, r.totalCount, r.data
115
116
if ( result instanceof Promise ) {
116
117
result . then ( r => {
117
118
this . localPagination = Object . assign ( { } , this . localPagination , {
@@ -121,7 +122,16 @@ export default {
121
122
pageSize : ( pagination && pagination . pageSize ) ||
122
123
this . localPagination . pageSize
123
124
} )
125
+
126
+ // 为防止删除数据后导致页面当前页面数据长度为 0 ,自动翻页到上一页
127
+ if ( r . data . length == 0 && this . localPagination . current != 1 ) {
128
+ this . localPagination . current --
129
+ this . loadData ( )
130
+ return
131
+ }
124
132
133
+ // 这里用于判断接口是否有返回 r.totalCount 或 this.showPagination = false
134
+ // 当情况满足时,表示数据不满足分页大小,关闭 table 分页功能
125
135
! r . totalCount && [ 'auto' , false ] . includes ( this . showPagination ) && ( this . localPagination = false )
126
136
this . localDataSource = r . data // 返回结果中的数组数据
127
137
this . localLoading = false
You can’t perform that action at this time.
0 commit comments