Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0506c4e5
authored
Mar 10, 2023
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重构:在 config 列表,引入分页组件
parent
ba563f76
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
src/components/Pagination/index.vue
+5
-5
src/views/infra/config/index.vue
+8
-1
No files found.
src/components/Pagination/index.vue
View file @
0506c4e5
<
template
>
<
template
>
<div
:class=
"
{
'hidden':
hidden }" class="pagination-container">
<div
:class=
"
{ hidden }" class="pagination-container">
<el-pagination
<el-pagination
:background=
"background"
:background=
"background"
v-model:current-page=
"currentPage"
v-model:current-page=
"currentPage"
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
// TODO 芋艿:ts 重写
// TODO 芋艿:ts 重写
// TODO 芋艿:scrollTo 接入
// TODO 芋艿:scrollTo 接入
// import { scrollTo } from '@/utils/scroll-to'
// import { scrollTo } from '@/utils/scroll-to'
import
{
computed
}
from
'vue'
const
props
=
defineProps
({
const
props
=
defineProps
({
total
:
{
total
:
{
...
@@ -38,7 +39,7 @@ const props = defineProps({
...
@@ -38,7 +39,7 @@ const props = defineProps({
return
[
10
,
20
,
30
,
50
]
return
[
10
,
20
,
30
,
50
]
}
}
},
},
// 移动端页码按钮的数量端默认值5
// 移动端页码按钮的数量端默认值
5
pagerCount
:
{
pagerCount
:
{
type
:
Number
,
type
:
Number
,
default
:
document
.
body
.
clientWidth
<
992
?
5
:
7
default
:
document
.
body
.
clientWidth
<
992
?
5
:
7
...
@@ -61,7 +62,7 @@ const props = defineProps({
...
@@ -61,7 +62,7 @@ const props = defineProps({
}
}
})
})
const
emit
=
defineEmits
(
);
const
emit
=
defineEmits
(
[
'update:page'
,
'update:limit'
,
'pagination'
,
'pagination'
])
const
currentPage
=
computed
({
const
currentPage
=
computed
({
get
()
{
get
()
{
return
props
.
page
return
props
.
page
...
@@ -74,7 +75,7 @@ const pageSize = computed({
...
@@ -74,7 +75,7 @@ const pageSize = computed({
get
()
{
get
()
{
return
props
.
limit
return
props
.
limit
},
},
set
(
val
){
set
(
val
)
{
emit
(
'update:limit'
,
val
)
emit
(
'update:limit'
,
val
)
}
}
})
})
...
@@ -93,7 +94,6 @@ function handleCurrentChange(val) {
...
@@ -93,7 +94,6 @@ function handleCurrentChange(val) {
// scrollTo(0, 800)
// scrollTo(0, 800)
}
}
}
}
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
...
...
src/views/infra/config/index.vue
View file @
0506c4e5
...
@@ -103,6 +103,13 @@
...
@@ -103,6 +103,13 @@
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
<Pagination
v-show=
"total > 0"
:total=
"total"
v-model:page=
"queryParams.pageNo"
v-model:limit=
"queryParams.pageSize"
@
pagination=
"getList"
/>
</content-wrap>
</content-wrap>
<!-- 表单弹窗:添加/修改 -->
<!-- 表单弹窗:添加/修改 -->
...
@@ -137,7 +144,7 @@ const getList = async () => {
...
@@ -137,7 +144,7 @@ const getList = async () => {
try
{
try
{
const
data
=
await
ConfigApi
.
getConfigPage
(
queryParams
)
const
data
=
await
ConfigApi
.
getConfigPage
(
queryParams
)
list
.
value
=
data
.
list
list
.
value
=
data
.
list
total
.
value
=
data
.
value
total
.
value
=
data
.
total
}
finally
{
}
finally
{
loading
.
value
=
false
loading
.
value
=
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