Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ant-design-pro-vue
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tianzhuanghu
ant-design-pro-vue
Commits
8ca1ae84
Unverified
Commit
8ca1ae84
authored
Jan 14, 2019
by
Sendya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: #56 current page -1 refresh table
parent
1896271b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
index.js
src/components/table/index.js
+10
-0
No files found.
src/components/table/index.js
View file @
8ca1ae84
...
@@ -112,6 +112,7 @@ export default {
...
@@ -112,6 +112,7 @@ export default {
)
)
)
)
// 对接自己的通用数据接口需要修改下方代码中的 r.pageNo, r.totalCount, r.data
if
(
result
instanceof
Promise
)
{
if
(
result
instanceof
Promise
)
{
result
.
then
(
r
=>
{
result
.
then
(
r
=>
{
this
.
localPagination
=
Object
.
assign
({},
this
.
localPagination
,
{
this
.
localPagination
=
Object
.
assign
({},
this
.
localPagination
,
{
...
@@ -121,7 +122,16 @@ export default {
...
@@ -121,7 +122,16 @@ export default {
pageSize
:
(
pagination
&&
pagination
.
pageSize
)
||
pageSize
:
(
pagination
&&
pagination
.
pageSize
)
||
this
.
localPagination
.
pageSize
this
.
localPagination
.
pageSize
})
})
// 为防止删除数据后导致页面当前页面数据长度为 0 ,自动翻页到上一页
if
(
r
.
data
.
length
==
0
&&
this
.
localPagination
.
current
!=
1
)
{
this
.
localPagination
.
current
--
this
.
loadData
()
return
}
// 这里用于判断接口是否有返回 r.totalCount 或 this.showPagination = false
// 当情况满足时,表示数据不满足分页大小,关闭 table 分页功能
!
r
.
totalCount
&&
[
'auto'
,
false
].
includes
(
this
.
showPagination
)
&&
(
this
.
localPagination
=
false
)
!
r
.
totalCount
&&
[
'auto'
,
false
].
includes
(
this
.
showPagination
)
&&
(
this
.
localPagination
=
false
)
this
.
localDataSource
=
r
.
data
// 返回结果中的数组数据
this
.
localDataSource
=
r
.
data
// 返回结果中的数组数据
this
.
localLoading
=
false
this
.
localLoading
=
false
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment