提交 c076fd00 编写于 作者: D DCloud_LXH

chore: scroll-view

上级 b58eea43
...@@ -86,11 +86,13 @@ import { ...@@ -86,11 +86,13 @@ import {
disableScrollBounce disableScrollBounce
} from 'uni-platform/helpers/scroll' } from 'uni-platform/helpers/scroll'
const passiveOptions = supportsPassive const passive = (passive = true) =>
? { supportsPassive
passive: true ? {
} passive
: false }
: false
const passiveOptions = passive()
// const PULLING = 'pulling' // const PULLING = 'pulling'
// const REFRESHING = 'refreshing' // const REFRESHING = 'refreshing'
...@@ -322,34 +324,10 @@ export default { ...@@ -322,34 +324,10 @@ export default {
self._setRefreshState('refresherabort') self._setRefreshState('refresherabort')
} }
} }
this.$refs.main.addEventListener( this.$refs.main.addEventListener('touchstart', this.__handleTouchStart, passiveOptions)
'touchstart', this.$refs.main.addEventListener('touchmove', this.__handleTouchMove, passive(false))
this.__handleTouchStart, this.$refs.main.addEventListener('scroll', this.__handleScroll, passive(false))
passiveOptions this.$refs.main.addEventListener('touchend', this.__handleTouchEnd, passiveOptions)
)
this.$refs.main.addEventListener(
'touchmove',
this.__handleTouchMove,
supportsPassive
? {
passive: false
}
: false
)
this.$refs.main.addEventListener(
'scroll',
this.__handleScroll,
supportsPassive
? {
passive: false
}
: false
)
this.$refs.main.addEventListener(
'touchend',
this.__handleTouchEnd,
passiveOptions
)
initScrollBounce() initScrollBounce()
}, },
activated () { activated () {
...@@ -371,11 +349,7 @@ export default { ...@@ -371,11 +349,7 @@ export default {
this.$refs.main.removeEventListener( this.$refs.main.removeEventListener(
'scroll', 'scroll',
this.__handleScroll, this.__handleScroll,
supportsPassive passive(false)
? {
passive: false
}
: false
) )
this.$refs.main.removeEventListener( this.$refs.main.removeEventListener(
'touchend', 'touchend',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册