Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
najiu-frontend
najiu-admin-template
Commits
d8c38207
Commit
d8c38207
authored
Jul 05, 2021
by
无木
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(table): scrollbar style
parent
f4778431
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
2 deletions
+63
-2
useTableScroll.ts
src/components/Table/src/hooks/useTableScroll.ts
+17
-0
table.less
src/design/ant/table.less
+46
-2
No files found.
src/components/Table/src/hooks/useTableScroll.ts
View file @
d8c38207
...
@@ -68,6 +68,23 @@ export function useTableScroll(
...
@@ -68,6 +68,23 @@ export function useTableScroll(
bodyEl
=
tableEl
.
querySelector
(
'
.ant-table-body
'
);
bodyEl
=
tableEl
.
querySelector
(
'
.ant-table-body
'
);
}
}
const
hasScrollBarY
=
bodyEl
.
scrollHeight
>
bodyEl
.
clientHeight
;
const
hasScrollBarX
=
bodyEl
.
scrollWidth
>
bodyEl
.
clientWidth
;
if
(
hasScrollBarY
)
{
tableEl
.
classList
.
contains
(
'
hide-scrollbar-y
'
)
&&
tableEl
.
classList
.
remove
(
'
hide-scrollbar-y
'
);
}
else
{
!
tableEl
.
classList
.
contains
(
'
hide-scrollbar-y
'
)
&&
tableEl
.
classList
.
add
(
'
hide-scrollbar-y
'
);
}
if
(
hasScrollBarX
)
{
tableEl
.
classList
.
contains
(
'
hide-scrollbar-x
'
)
&&
tableEl
.
classList
.
remove
(
'
hide-scrollbar-x
'
);
}
else
{
!
tableEl
.
classList
.
contains
(
'
hide-scrollbar-x
'
)
&&
tableEl
.
classList
.
add
(
'
hide-scrollbar-x
'
);
}
bodyEl
!
.
style
.
height
=
'
unset
'
;
bodyEl
!
.
style
.
height
=
'
unset
'
;
if
(
!
unref
(
getCanResize
)
||
tableData
.
length
===
0
)
return
;
if
(
!
unref
(
getCanResize
)
||
tableData
.
length
===
0
)
return
;
...
...
src/design/ant/table.less
View file @
d8c38207
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
// fix table unnecessary scrollbar
// fix table unnecessary scrollbar
.@{prefix-cls} {
.@{prefix-cls} {
.
ant-table-wrapper
{
.
hide-scrollbar-y
{
.ant-spin-nested-loading {
.ant-spin-nested-loading {
.ant-spin-container {
.ant-spin-container {
.ant-table {
.ant-table {
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
}
}
.ant-table-body {
.ant-table-body {
overflow: auto !important;
overflow
-y
: auto !important;
}
}
}
}
...
@@ -24,6 +24,50 @@
...
@@ -24,6 +24,50 @@
}
}
}
}
}
}
.ant-table-fixed-left {
.ant-table-body-outer {
.ant-table-body-inner {
overflow-y: auto !important;
}
}
}
}
}
}
}
}
.hide-scrollbar-x {
.ant-spin-nested-loading {
.ant-spin-container {
.ant-table {
.ant-table-content {
.ant-table-scroll {
.ant-table-hide-scrollbar {
//overflow-x: auto !important;
}
.ant-table-body {
overflow: auto !important;
}
}
.ant-table-fixed-right {
.ant-table-body-outer {
.ant-table-body-inner {
overflow-x: auto !important;
}
}
}
.ant-table-fixed-left {
.ant-table-body-outer {
.ant-table-body-inner {
overflow-x: auto !important;
}
}
}
}
}
}
}
}
}
...
...
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