Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wychl
uni-app
提交
cb3ec1ab
U
uni-app
项目概览
wychl
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cb3ec1ab
编写于
7月 07, 2021
作者:
D
DCloud_LXH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: scroll-view refresherTriggered
上级
7a790bc2
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
31 addition
and
26 deletion
+31
-26
src/core/view/components/scroll-view/index.vue
src/core/view/components/scroll-view/index.vue
+31
-26
未找到文件。
src/core/view/components/scroll-view/index.vue
浏览文件 @
cb3ec1ab
...
...
@@ -196,7 +196,14 @@ export default {
},
mounted
()
{
var
self
=
this
var
touchStart
=
null
var
needStop
=
null
this
.
_attached
=
true
this
.
toUpperNumber
=
0
// 容器触顶时,此时鼠标Y轴位置
this
.
triggerAbort
=
false
this
.
beforeRefreshing
=
false
this
.
_scrollTopChanged
(
this
.
scrollTopNumber
)
this
.
_scrollLeftChanged
(
this
.
scrollLeftNumber
)
this
.
_scrollIntoViewChanged
(
this
.
scrollIntoView
)
...
...
@@ -205,11 +212,6 @@ export default {
event
.
stopPropagation
()
self
.
_handleScroll
.
bind
(
self
,
event
)()
}
var
touchStart
=
null
var
needStop
=
null
let
toUpperNumber
=
0
// 容器触顶时,此时鼠标Y轴位置
let
triggerAbort
=
false
let
beforeRefreshing
=
false
this
.
__handleTouchMove
=
function
(
event
)
{
var
x
=
event
.
touches
[
0
].
pageX
...
...
@@ -258,14 +260,14 @@ export default {
if
(
self
.
refresherEnabled
&&
self
.
refreshState
===
'
pulling
'
)
{
const
dy
=
y
-
touchStart
.
y
if
(
toUpperNumber
===
0
)
{
toUpperNumber
=
y
if
(
self
.
toUpperNumber
===
0
)
{
self
.
toUpperNumber
=
y
}
if
(
!
beforeRefreshing
)
{
self
.
refresherHeight
=
y
-
toUpperNumber
if
(
!
self
.
beforeRefreshing
)
{
self
.
refresherHeight
=
y
-
self
.
toUpperNumber
// 之前为刷新状态则不再触发pulling
if
(
self
.
refresherHeight
>
0
)
{
triggerAbort
=
true
self
.
triggerAbort
=
true
self
.
$trigger
(
'
refresherpulling
'
,
event
,
{
deltaY
:
dy
})
...
...
@@ -273,7 +275,7 @@ export default {
}
else
{
self
.
refresherHeight
=
dy
+
self
.
refresherThreshold
// 如果之前在刷新状态,则不触发刷新中断
triggerAbort
=
false
self
.
triggerAbort
=
false
}
const
route
=
self
.
refresherHeight
/
self
.
refresherThreshold
...
...
@@ -298,20 +300,9 @@ export default {
disable
:
false
})
if
(
self
.
refresherHeight
>=
self
.
refresherThreshold
)
{
self
.
refresherHeight
=
self
.
refresherThreshold
self
.
refreshState
=
'
refreshing
'
// 之前是刷新状态则不再触发刷新
if
(
beforeRefreshing
)
return
beforeRefreshing
=
true
self
.
_setRefreshState
(
'
refreshing
'
)
}
else
{
beforeRefreshing
=
false
self
.
refreshState
=
'
refresherabort
'
self
.
refresherHeight
=
toUpperNumber
=
0
if
(
triggerAbort
)
{
triggerAbort
=
false
self
.
$trigger
(
'
refresherabort
'
,
event
,
{})
}
self
.
_setRefreshState
(
'
refresherabort
'
)
}
}
this
.
$refs
.
main
.
addEventListener
(
'
touchstart
'
,
this
.
__handleTouchStart
,
passiveOptions
)
...
...
@@ -521,11 +512,25 @@ export default {
switch
(
state
)
{
case
'
refreshing
'
:
this
.
refresherHeight
=
this
.
refresherThreshold
this
.
$trigger
(
'
refresherrefresh
'
,
event
,
{})
// 之前是刷新状态则不再触发刷新
if
(
!
this
.
beforeRefreshing
)
{
this
.
beforeRefreshing
=
true
this
.
$trigger
(
'
refresherrefresh
'
,
{},
{})
this
.
$emit
(
'
update:refresherTriggered
'
,
true
)
}
break
case
'
restore
'
:
this
.
refresherHeight
=
0
case
'
refresherabort
'
:
this
.
beforeRefreshing
=
false
this
.
refresherHeight
=
this
.
toUpperNumber
=
0
if
(
state
===
'
restore
'
)
{
this
.
triggerAbort
=
false
this
.
$trigger
(
'
refresherrestore
'
,
{},
{})
}
if
(
state
===
'
refresherabort
'
&&
this
.
triggerAbort
)
{
this
.
triggerAbort
=
false
this
.
$trigger
(
'
refresherabort
'
,
{},
{})
}
break
}
this
.
refreshState
=
state
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录