提交 6c6903d3 编写于 作者: Q qiang

fix: 解决 iOS13 部分组件触摸交互时UI失去响应的问题 question/98881

上级 54cb9604
......@@ -3,6 +3,7 @@ import {
deepClone
} from 'uni-shared'
import {
initScrollBounce,
disableScrollBounce
} from 'uni-platform/helpers/scroll'
......@@ -34,6 +35,7 @@ export default {
},
mounted: function () {
this._resize()
initScrollBounce()
},
methods: {
_resize () {
......
......@@ -12,6 +12,7 @@ import {
STD
} from './utils'
import {
initScrollBounce,
disableScrollBounce
} from 'uni-platform/helpers/scroll'
var requesting = false
......@@ -227,6 +228,7 @@ export default {
this._friction.reconfigure(1, this.frictionNumber)
this._STD.reconfigure(1, 9 * Math.pow(this.dampingNumber, 2) / 40, this.dampingNumber)
this.$el.style.transformOrigin = 'center'
initScrollBounce()
},
methods: {
_getPx (val) {
......
......@@ -8,6 +8,7 @@ import {
Spring
} from 'uni-mixins/scroller/Spring'
import {
initScrollBounce,
disableScrollBounce
} from 'uni-platform/helpers/scroll'
......@@ -93,6 +94,7 @@ export default {
this.update()
})
initClick(this.$el)
initScrollBounce()
},
methods: {
_setItemHeight (height) {
......
......@@ -74,6 +74,7 @@ import {
supportsPassive
} from 'uni-shared'
import {
initScrollBounce,
disableScrollBounce
} from 'uni-platform/helpers/scroll'
......@@ -294,6 +295,7 @@ export default {
passive: false
} : false)
this.$refs.main.addEventListener('touchend', this.__handleTouchEnd, passiveOptions)
initScrollBounce()
},
activated () {
// 还原 scroll-view 滚动位置
......
......@@ -2,40 +2,26 @@ import {
plusReady
} from 'uni-shared'
let view
let webview
let pullToRefreshStyle
let disabled
const lastAction = {}
export function initScrollBounce () {
plusReady(() => {
if (!webview) {
webview = plus.webview.currentWebview()
}
if (!pullToRefreshStyle) {
pullToRefreshStyle = (webview.getStyle() || {}).pullToRefresh || {}
}
})
}
export function disableScrollBounce ({
disable
}) {
function exec () {
if (!view) {
view = plus.webview.currentWebview()
}
if (!disabled) {
pullToRefreshStyle = (view.getStyle() || {}).pullToRefresh || {}
}
disabled = disable
if (pullToRefreshStyle.support) {
view.setPullToRefresh(Object.assign({}, pullToRefreshStyle, {
support: !disable
}))
}
}
const time = Date.now()
if (disable === lastAction.disable && time - lastAction.time < 20) {
return
if (pullToRefreshStyle && pullToRefreshStyle.support) {
webview.setPullToRefresh(Object.assign({}, pullToRefreshStyle, {
support: !disable
}))
}
lastAction.disable = disable
lastAction.time = time
plusReady(() => {
if (plus.os.name === 'iOS') {
// 延迟执行避免iOS13触摸卡死
setTimeout(exec, 20)
} else {
exec()
}
})
}
export function initScrollBounce () {
}
export function disableScrollBounce ({
disable
}) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册