Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
liuzhen@situdata.com
/
yunxiao-admin-fe
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
62fd5365
authored
2020-10-29 16:32:43 +0800
by
zhen
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化分页组件props
1 parent
6ac9f8bb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
51 deletions
src/views/components/FooterPagination.vue
src/views/monitor.vue
src/views/components/FooterPagination.vue
View file @
62fd536
...
...
@@ -5,6 +5,7 @@
layout=
"total, prev, pager, next, sizes, jumper"
:total=
"pagination.total"
:current-page
.
sync=
"pagination.page"
:page-size
.
sync=
"pagination.size"
@
current-change=
"handleCurrentChange"
@
size-change=
"handleSizeChange"
></el-pagination>
...
...
@@ -14,38 +15,17 @@
<
script
>
export
default
{
props
:
{
total
:
{
type
:
Number
,
default
:
0
pagination
:
{
type
:
Object
,
default
:
()
=>
({
size
:
10
,
total
:
0
,
page
:
1
})
}
},
data
()
{
return
{
pagination
:
{
size
:
10
,
total
:
this
.
total
,
page
:
1
}
}
},
watch
:
{
total
(
val
)
{
this
.
pagination
.
total
=
val
}
},
mounted
()
{
this
.
$emit
(
'pager'
,
{
...
this
.
pagination
})
},
methods
:
{
changeCurrentSize
(
page
)
{
this
.
pagination
.
page
=
page
this
.
handleCurrentChange
(
page
)
},
handleCurrentChange
(
page
)
{
this
.
$emit
(
'pag
er
'
,
{
...
this
.
pagination
,
page
})
this
.
$emit
(
'pag
ination
'
,
{
...
this
.
pagination
,
page
})
},
handleSizeChange
(
size
)
{
this
.
$emit
(
'pag
er
'
,
{
...
this
.
pagination
,
size
})
this
.
$emit
(
'pag
ination
'
,
{
...
this
.
pagination
,
size
})
}
}
}
...
...
src/views/monitor.vue
View file @
62fd536
...
...
@@ -103,11 +103,7 @@
</
template
>
</el-table-column>
</el-table>
<FooterPaginationfrom
ref=
"paginationRef"
:total=
"total"
@
pager=
"handleGetPager"
></FooterPaginationfrom>
<FooterPaginationfrom
:pagination=
"pagination"
></FooterPaginationfrom>
</Card>
</template>
...
...
@@ -132,14 +128,25 @@ export default {
times
:
[
''
,
''
]
},
tableData
:
[],
pagination
:
null
,
loading
:
false
,
total
:
0
pagination
:
{
size
:
10
,
total
:
0
,
page
:
1
},
loading
:
false
}
},
watch
:
{
'pagination.size'
()
{
this
.
handleGetResourceMonitorList
()
},
'pagination.page'
()
{
this
.
handleGetResourceMonitorList
()
}
},
mounted
()
{
this
.
handleGetResourceMonitorList
()
},
methods
:
{
async
handleGetResourceMonitorList
()
{
try
{
this
.
loading
=
true
const
{
result
:
{
list
,
total
}
}
=
await
getResourceMonitorList
({
...
...
@@ -151,14 +158,19 @@ export default {
row
:
this
.
pagination
.
size
})
this
.
tableData
=
list
this
.
total
=
total
this
.
pagination
.
total
=
total
}
catch
(
error
)
{
console
.
log
(
error
)
}
finally
{
this
.
loading
=
false
}
},
submit
()
{
// 会触发pager事件
this
.
$refs
.
paginationRef
.
changeCurrentSize
(
1
)
if
(
this
.
pagination
.
page
===
1
)
{
this
.
handleGetResourceMonitorList
()
}
else
{
this
.
pagination
.
page
=
1
}
},
onReset
()
{
this
.
ruleForm
=
{
...
...
@@ -168,20 +180,6 @@ export default {
}
this
.
submit
()
},
handleGetPager
(
data
)
{
this
.
pagination
=
data
this
.
handleQueryOrderList
()
},
async
handleQueryOrderList
()
{
try
{
this
.
loading
=
true
await
this
.
handleGetResourceMonitorList
()
}
catch
(
error
)
{
console
.
log
(
error
)
}
finally
{
this
.
loading
=
false
}
},
handleDetail
(
row
)
{
this
.
$router
.
push
({
path
:
'monitor-details'
,
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment