Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dyingstraw
vue-element-admin
提交
85492f14
V
vue-element-admin
项目概览
dyingstraw
/
vue-element-admin
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-element-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
85492f14
编写于
12月 12, 2017
作者:
P
Pan
提交者:
花裤衩
12月 12, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix[scrollPane&&scrollBar]:fixed scroll bug in Firefox
上级
b7ca7867
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
10 deletion
+12
-10
src/components/ScrollBar/index.vue
src/components/ScrollBar/index.vue
+6
-5
src/components/ScrollPane/index.vue
src/components/ScrollPane/index.vue
+6
-5
未找到文件。
src/components/ScrollBar/index.vue
浏览文件 @
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
...
...
src/components/ScrollPane/index.vue
浏览文件 @
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
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录