Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VueElementTemplate
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
黄瑜
VueElementTemplate
Commits
85492f14
Commit
85492f14
authored
7 years ago
by
Pan
Committed by
花裤衩
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix[scrollPane&&scrollBar]:fixed scroll bug in Firefox
parent
b7ca7867
master
storybook
test
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
index.vue
src/components/ScrollBar/index.vue
+6
-5
index.vue
src/components/ScrollPane/index.vue
+6
-5
No files found.
src/components/ScrollBar/index.vue
View file @
85492f14
<
template
>
<div
class=
"scroll-container"
ref=
"scrollContainer"
@
mousewheel=
"handleScroll"
>
<div
class=
"scroll-container"
ref=
"scrollContainer"
@
wheel
.
prevent=
"handleScroll"
>
<div
class=
"scroll-wrapper"
ref=
"scrollWrapper"
:style=
"
{top: top + 'px'}">
<slot></slot>
</div>
...
...
@@ -8,6 +8,7 @@
<
script
>
const
delta
=
15
export
default
{
name
:
'scrollBar'
,
data
()
{
...
...
@@ -17,19 +18,19 @@ export default {
},
methods
:
{
handleScroll
(
e
)
{
e
.
preventDefault
()
const
eventDelta
=
e
.
wheelDelta
||
-
e
.
deltaY
*
3
const
$container
=
this
.
$refs
.
scrollContainer
const
$containerHeight
=
$container
.
offsetHeight
const
$wrapper
=
this
.
$refs
.
scrollWrapper
const
$wrapperHeight
=
$wrapper
.
offsetHeight
if
(
e
.
wheel
Delta
>
0
)
{
this
.
top
=
Math
.
min
(
0
,
this
.
top
+
e
.
wheel
Delta
)
if
(
e
vent
Delta
>
0
)
{
this
.
top
=
Math
.
min
(
0
,
this
.
top
+
e
vent
Delta
)
}
else
{
if
(
$containerHeight
-
delta
<
$wrapperHeight
)
{
if
(
this
.
top
<
-
(
$wrapperHeight
-
$containerHeight
+
delta
))
{
this
.
top
=
this
.
top
}
else
{
this
.
top
=
Math
.
max
(
this
.
top
+
e
.
wheel
Delta
,
$containerHeight
-
$wrapperHeight
-
delta
)
this
.
top
=
Math
.
max
(
this
.
top
+
e
vent
Delta
,
$containerHeight
-
$wrapperHeight
-
delta
)
}
}
else
{
this
.
top
=
0
...
...
This diff is collapsed.
Click to expand it.
src/components/ScrollPane/index.vue
View file @
85492f14
<
template
>
<div
class=
"scroll-container"
ref=
"scrollContainer"
@
mousewheel
=
"handleScroll"
>
<div
class=
"scroll-container"
ref=
"scrollContainer"
@
wheel
.
prevent
=
"handleScroll"
>
<div
class=
"scroll-wrapper"
ref=
"scrollWrapper"
:style=
"
{left: left + 'px'}">
<slot></slot>
</div>
...
...
@@ -18,20 +18,20 @@ export default {
},
methods
:
{
handleScroll
(
e
)
{
e
.
preventDefault
()
const
eventDelta
=
e
.
wheelDelta
||
-
e
.
deltaY
*
3
const
$container
=
this
.
$refs
.
scrollContainer
const
$containerWidth
=
$container
.
offsetWidth
const
$wrapper
=
this
.
$refs
.
scrollWrapper
const
$wrapperWidth
=
$wrapper
.
offsetWidth
if
(
e
.
wheel
Delta
>
0
)
{
this
.
left
=
Math
.
min
(
0
,
this
.
left
+
e
.
wheel
Delta
)
if
(
e
vent
Delta
>
0
)
{
this
.
left
=
Math
.
min
(
0
,
this
.
left
+
e
vent
Delta
)
}
else
{
if
(
$containerWidth
-
padding
<
$wrapperWidth
)
{
if
(
this
.
left
<
-
(
$wrapperWidth
-
$containerWidth
+
padding
))
{
this
.
left
=
this
.
left
}
else
{
this
.
left
=
Math
.
max
(
this
.
left
+
e
.
wheel
Delta
,
$containerWidth
-
$wrapperWidth
-
padding
)
this
.
left
=
Math
.
max
(
this
.
left
+
e
vent
Delta
,
$containerWidth
-
$wrapperWidth
-
padding
)
}
}
else
{
this
.
left
=
0
...
...
@@ -64,6 +64,7 @@ export default {
white-space
:
nowrap
;
position
:
relative
;
overflow
:
hidden
;
width
:
100%
;
.scroll-wrapper
{
position
:
absolute
;
}
...
...
This diff is collapsed.
Click to expand it.
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