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
96ec260f
Commit
96ec260f
authored
Feb 24, 2019
by
Sendya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: s-table May lose pageSize bug, update demo list
parent
b0aed30f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
9 deletions
+12
-9
index.js
src/components/table/index.js
+9
-6
List.vue
src/views/list/table/List.vue
+3
-3
No files found.
src/components/table/index.js
View file @
96ec260f
...
@@ -104,7 +104,10 @@ export default {
...
@@ -104,7 +104,10 @@ export default {
* @param Boolean bool
* @param Boolean bool
*/
*/
refresh
(
bool
=
false
)
{
refresh
(
bool
=
false
)
{
this
.
loadData
(
bool
?
{
current
:
1
}
:
{})
bool
&&
(
this
.
localPagination
=
Object
.
assign
({},
{
current
:
1
,
pageSize
:
this
.
pageSize
}))
this
.
loadData
()
},
},
/**
/**
* 加载数据方法
* 加载数据方法
...
@@ -114,11 +117,11 @@ export default {
...
@@ -114,11 +117,11 @@ export default {
*/
*/
loadData
(
pagination
,
filters
,
sorter
)
{
loadData
(
pagination
,
filters
,
sorter
)
{
this
.
localLoading
=
true
this
.
localLoading
=
true
var
result
=
this
.
data
(
Object
.
assign
({
const
parameter
=
Object
.
assign
({
pageNo
:
(
pagination
&&
pagination
.
current
)
||
pageNo
:
(
pagination
&&
pagination
.
current
)
||
this
.
localPagination
.
current
,
this
.
localPagination
.
current
,
pageSize
:
(
pagination
&&
pagination
.
pageSize
)
||
pageSize
:
(
pagination
&&
pagination
.
pageSize
)
||
this
.
localPagination
.
pageSize
this
.
localPagination
.
pageSize
},
},
(
sorter
&&
sorter
.
field
&&
{
(
sorter
&&
sorter
.
field
&&
{
sortField
:
sorter
.
field
sortField
:
sorter
.
field
...
@@ -128,7 +131,8 @@ export default {
...
@@ -128,7 +131,8 @@ export default {
})
||
{},
{
})
||
{},
{
...
filters
...
filters
}
}
))
)
const
result
=
this
.
data
(
parameter
)
// 对接自己的通用数据接口需要修改下方代码中的 r.pageNo, r.totalCount, r.data
// 对接自己的通用数据接口需要修改下方代码中的 r.pageNo, r.totalCount, r.data
// eslint-disable-next-line
// eslint-disable-next-line
if
(
result
instanceof
Promise
||
'[object Promise]'
===
result
.
toString
())
{
if
(
result
instanceof
Promise
||
'[object Promise]'
===
result
.
toString
())
{
...
@@ -140,7 +144,6 @@ export default {
...
@@ -140,7 +144,6 @@ export default {
pageSize
:
(
pagination
&&
pagination
.
pageSize
)
||
pageSize
:
(
pagination
&&
pagination
.
pageSize
)
||
this
.
localPagination
.
pageSize
this
.
localPagination
.
pageSize
})
})
// 为防止删除数据后导致页面当前页面数据长度为 0 ,自动翻页到上一页
// 为防止删除数据后导致页面当前页面数据长度为 0 ,自动翻页到上一页
if
(
r
.
data
.
length
===
0
&&
this
.
localPagination
.
current
!==
1
)
{
if
(
r
.
data
.
length
===
0
&&
this
.
localPagination
.
current
!==
1
)
{
this
.
localPagination
.
current
--
this
.
localPagination
.
current
--
...
...
src/views/list/table/List.vue
View file @
96ec260f
...
@@ -63,6 +63,7 @@
...
@@ -63,6 +63,7 @@
<div
class=
"table-operator"
>
<div
class=
"table-operator"
>
<a-button
type=
"primary"
icon=
"plus"
@
click=
"$router.push({ name: 'QueryListEdit' })"
>
新建
</a-button>
<a-button
type=
"primary"
icon=
"plus"
@
click=
"$router.push({ name: 'QueryListEdit' })"
>
新建
</a-button>
<a-button
type=
"dashed"
@
click=
"tableOption(false)"
v-if=
"optionAlertShow"
>
关闭 alert
</a-button>
<a-dropdown
v-action:edit
v-if=
"selectedRowKeys.length > 0"
>
<a-dropdown
v-action:edit
v-if=
"selectedRowKeys.length > 0"
>
<a-menu
slot=
"overlay"
>
<a-menu
slot=
"overlay"
>
<a-menu-item
key=
"1"
><a-icon
type=
"delete"
/>
删除
</a-menu-item>
<a-menu-item
key=
"1"
><a-icon
type=
"delete"
/>
删除
</a-menu-item>
...
@@ -75,12 +76,10 @@
...
@@ -75,12 +76,10 @@
</a-dropdown>
</a-dropdown>
</div>
</div>
<div>
<a-button
@
click=
"tableOption(false)"
v-if=
"optionAlertShow"
>
关闭 alert
</a-button>
</div>
<s-table
<s-table
ref=
"table"
ref=
"table"
size=
"default"
size=
"default"
rowKey=
"key"
:columns=
"columns"
:columns=
"columns"
:data=
"loadData"
:data=
"loadData"
:alert=
"options.alert"
:alert=
"options.alert"
...
@@ -172,6 +171,7 @@ export default {
...
@@ -172,6 +171,7 @@ export default {
],
],
// 加载数据方法 必须为 Promise 对象
// 加载数据方法 必须为 Promise 对象
loadData
:
parameter
=>
{
loadData
:
parameter
=>
{
console
.
log
(
'loadData.parameter'
,
parameter
)
return
getServiceList
(
Object
.
assign
(
parameter
,
this
.
queryParam
))
return
getServiceList
(
Object
.
assign
(
parameter
,
this
.
queryParam
))
.
then
(
res
=>
{
.
then
(
res
=>
{
return
res
.
result
return
res
.
result
...
...
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