Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
member
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
member
member
Commits
26e96050
Commit
26e96050
authored
Aug 23, 2022
by
曾经
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
table-sticky
parent
2c02a409
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
table-sticky.js
src/utils/table-sticky.js
+10
-8
No files found.
src/utils/table-sticky.js
View file @
26e96050
...
...
@@ -64,7 +64,6 @@ export default {
},
async
initFixedHeader
()
{
if
(
this
.
parent
)
{
// console.log('启动监听,页面:', this.parent)
this
.
parentDom
=
document
.
getElementsByClassName
(
this
.
parent
)
if
(
this
.
parentDom
&&
this
.
parentDom
.
length
!==
0
)
{
this
.
tableWidth
=
this
.
parentDom
[
0
].
querySelector
(
'.el-table__header-wrapper'
).
getBoundingClientRect
().
width
...
...
@@ -156,7 +155,7 @@ export default {
let
{
dom
}
=
this
.
getFixedDom
()
if
(
dom
.
classList
.
contains
(
'fixed'
))
{
let
timer
=
setTimeout
(()
=>
{
this
.
parentDom
[
0
].
getElementsByClassName
(
'el-table__fixed-body-wrapper'
)[
0
].
style
.
top
=
this
.
headerTop
this
.
parentDom
[
0
].
getElementsByClassName
(
'el-table__fixed-body-wrapper'
)[
0
].
style
.
top
=
this
.
headerTop
+
'px'
let
container
=
this
.
containerDom
if
(
container
&&
container
[
0
])
{
container
[
0
].
scrollTop
=
container
[
0
].
scrollTop
+
3
;
...
...
@@ -190,7 +189,7 @@ export default {
let
{
height
,
top
,
left
}
=
this
.
tablexy
let
scrollTop
=
e
.
target
.
scrollTop
let
{
fixedRightHeaderDom
,
fixedRightBox
,
fixedLeftHeaderDom
,
fixedLeftBox
,
dom
}
=
this
.
getFixedDom
()
if
(
scrollTop
>=
height
/
2
+
top
)
{
if
(
scrollTop
>=
(
height
/
2
+
(
top
-
this
.
topMenuHeight
))
)
{
// 存在右侧固定表头
if
(
fixedRightHeaderDom
)
{
this
.
setFixedStyle
({
...
...
@@ -215,7 +214,7 @@ export default {
this
.
updateWidth
()
dom
.
style
.
position
=
'fixed'
dom
.
style
.
zIndex
=
'2000'
dom
.
style
.
top
=
this
.
headerTop
dom
.
style
.
top
=
this
.
headerTop
+
'px'
dom
.
style
.
overflow
=
'hidden'
}
else
{
this
.
clearFixedStyle
()
...
...
@@ -226,7 +225,7 @@ export default {
let
{
dom
,
scrollLeft
,
width
,
left
}
=
data
dom
.
style
.
zIndex
=
'2000'
dom
.
style
.
position
=
'fixed'
dom
.
style
.
top
=
this
.
headerTop
dom
.
style
.
top
=
this
.
headerTop
+
'px'
dom
.
scrollLeft
=
scrollLeft
dom
.
style
.
width
=
width
dom
.
style
.
overflow
=
'hidden'
...
...
@@ -246,13 +245,13 @@ export default {
if
(
fixedLeftHeaderDom
)
{
fixedLeftHeaderDom
.
style
.
zIndex
=
'0'
fixedLeftHeaderDom
.
style
.
position
=
'static'
fixedLeftHeaderDom
.
style
.
top
=
this
.
headerTop
fixedLeftHeaderDom
.
style
.
top
=
this
.
headerTop
+
'px'
fixedLeftHeaderDom
.
style
.
left
=
left
+
'px'
fixedLeftBox
.
style
.
top
=
getComputedStyle
(
dom
).
height
}
dom
.
classList
.
remove
(
'fixed'
)
dom
.
style
.
position
=
'static'
dom
.
style
.
top
=
this
.
headerTop
dom
.
style
.
top
=
this
.
headerTop
+
'px'
dom
.
style
.
zIndex
=
'0'
}
},
...
...
@@ -279,7 +278,9 @@ export default {
tableWidth
:
0
,
timerList
:
[],
tableDom
:
null
,
containerDom
:
null
containerDom
:
null
,
headerWidth
:
0
,
topMenuHeight
:
62
}
},
}
\ No newline at end of file
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