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
96e0ce98
authored
Mar 17, 2023
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Table 组件:1)增加 tableMethods 属性,提升代码的可阅读性;2)Table 和 Pagination 组件的逻辑统一
parent
714dd661
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
src/components/Pagination/index.vue
+1
-1
src/components/Table/src/Table.vue
+4
-2
src/hooks/web/useTable.ts
+3
-1
No files found.
src/components/Pagination/index.vue
View file @
96e0ce98
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
class=
"float-right mt-15px mb-15px"
class=
"float-right mt-15px mb-15px"
:background=
"true"
:background=
"true"
layout=
"total, sizes, prev, pager, next, jumper"
layout=
"total, sizes, prev, pager, next, jumper"
:page-sizes=
"[10, 20, 30, 50]"
:page-sizes=
"[10, 20, 30, 50
, 100
]"
v-model:current-page=
"currentPage"
v-model:current-page=
"currentPage"
v-model:page-size=
"pageSize"
v-model:page-size=
"pageSize"
:pager-count=
"pagerCount"
:pager-count=
"pagerCount"
...
...
src/components/Table/src/Table.vue
View file @
96e0ce98
...
@@ -104,11 +104,12 @@ export default defineComponent({
...
@@ -104,11 +104,12 @@ export default defineComponent({
})
})
const
pagination
=
computed
(()
=>
{
const
pagination
=
computed
(()
=>
{
// update by 芋艿:保持和 Pagination 组件的逻辑一致
return
Object
.
assign
(
return
Object
.
assign
(
{
{
small
:
false
,
small
:
false
,
background
:
true
,
background
:
true
,
pagerCount
:
5
,
pagerCount
:
document
.
body
.
clientWidth
<
992
?
5
:
7
,
layout
:
'total, sizes, prev, pager, next, jumper'
,
layout
:
'total, sizes, prev, pager, next, jumper'
,
pageSizes
:
[
10
,
20
,
30
,
50
,
100
],
pageSizes
:
[
10
,
20
,
30
,
50
,
100
],
disabled
:
false
,
disabled
:
false
,
...
@@ -283,10 +284,11 @@ export default defineComponent({
...
@@ -283,10 +284,11 @@ export default defineComponent({
}}
}}
<
/ElTable
>
<
/ElTable
>
{
unref
(
getProps
).
pagination
?
(
{
unref
(
getProps
).
pagination
?
(
// update by 芋艿:保持和 Pagination 组件一致
<
ElPagination
<
ElPagination
v
-
model
:
pageSize
=
{
pageSizeRef
.
value
}
v
-
model
:
pageSize
=
{
pageSizeRef
.
value
}
v
-
model
:
currentPage
=
{
currentPageRef
.
value
}
v
-
model
:
currentPage
=
{
currentPageRef
.
value
}
class
=
"
mt-10
px"
class
=
"
float-right mt-15px mb-15
px"
{...
unref
(
pagination
)}
{...
unref
(
pagination
)}
><
/ElPagination
>
><
/ElPagination
>
)
:
undefined
}
)
:
undefined
}
...
...
src/hooks/web/useTable.ts
View file @
96e0ce98
...
@@ -218,6 +218,8 @@ export const useTable = <T = any>(config?: UseTableConfig<T>) => {
...
@@ -218,6 +218,8 @@ export const useTable = <T = any>(config?: UseTableConfig<T>) => {
register
,
register
,
elTableRef
,
elTableRef
,
tableObject
,
tableObject
,
methods
methods
,
// add by 芋艿:返回 tableMethods 属性,和 tableObject 更统一
tableMethods
:
methods
}
}
}
}
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