You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by so...@apache.org on 2017/06/07 08:08:01 UTC
[02/50] incubator-weex git commit: * [html5] set one throttled scroll
handler for every list/scroller instance.
* [html5] set one throttled scroll handler for every list/scroller instance.
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/2ec3fa8e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/2ec3fa8e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/2ec3fa8e
Branch: refs/heads/0.14-dev
Commit: 2ec3fa8e5f8cf26cf88ff664ca1d60190b24d356
Parents: e8e286b
Author: MrRaindrop <te...@gmail.com>
Authored: Thu May 25 17:35:18 2017 +0800
Committer: MrRaindrop <te...@gmail.com>
Committed: Thu May 25 17:35:18 2017 +0800
----------------------------------------------------------------------
html5/render/vue/mixins/scrollable.js | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2ec3fa8e/html5/render/vue/mixins/scrollable.js
----------------------------------------------------------------------
diff --git a/html5/render/vue/mixins/scrollable.js b/html5/render/vue/mixins/scrollable.js
index b0a84de..9eb1209 100644
--- a/html5/render/vue/mixins/scrollable.js
+++ b/html5/render/vue/mixins/scrollable.js
@@ -18,16 +18,15 @@
*/
import { getThrottleLazyload, throttle } from '../utils'
-let throttleScroll
function getThrottledScroll (context) {
- if (!throttleScroll) {
+ if (!context._throttleScroll) {
const wrapper = context.$refs.wrapper
const inner = context.$refs.inner
let preOffset = (context.scrollDirection === 'horizontal'
? wrapper.scrollLeft
: wrapper.scrollTop)
|| 0
- throttleScroll = throttle(function (evt) {
+ context._throttleScroll = throttle(function (evt) {
const offset = context.scrollDirection === 'horizontal'
? wrapper.scrollLeft
: wrapper.scrollTop
@@ -65,7 +64,7 @@ function getThrottledScroll (context) {
}
}, 16, true)
}
- return throttleScroll
+ return context._throttleScroll
}
export default {