Showing
1 changed file
with
18 additions
and
7 deletions
@@ -34,6 +34,7 @@ import Vue from 'vue'; | @@ -34,6 +34,7 @@ import Vue from 'vue'; | ||
34 | import lazyload from 'vue-lazyload'; | 34 | import lazyload from 'vue-lazyload'; |
35 | import infinitScroll from 'vue-infinite-scroll'; | 35 | import infinitScroll from 'vue-infinite-scroll'; |
36 | import bus from 'common/vue-bus'; | 36 | import bus from 'common/vue-bus'; |
37 | +import yoho from 'yoho'; | ||
37 | 38 | ||
38 | Vue.use(lazyload, { preLoad: 3 }); | 39 | Vue.use(lazyload, { preLoad: 3 }); |
39 | Vue.use(infinitScroll); | 40 | Vue.use(infinitScroll); |
@@ -41,7 +42,9 @@ Vue.use(infinitScroll); | @@ -41,7 +42,9 @@ Vue.use(infinitScroll); | ||
41 | export default { | 42 | export default { |
42 | data() { | 43 | data() { |
43 | return { | 44 | return { |
44 | - hrefClass: {} | 45 | + hrefClass: { |
46 | + 'no-link': false | ||
47 | + } | ||
45 | }; | 48 | }; |
46 | }, | 49 | }, |
47 | props: { | 50 | props: { |
@@ -61,9 +64,20 @@ export default { | @@ -61,9 +64,20 @@ export default { | ||
61 | mounted() { | 64 | mounted() { |
62 | const $scrollEl = this.getScrollEventTarget(this.$el); | 65 | const $scrollEl = this.getScrollEventTarget(this.$el); |
63 | 66 | ||
64 | - $scrollEl.addEventListener('scroll', this.throttle(this.scrollEnd, 200)); | 67 | + if (yoho.isiOS) { |
68 | + $scrollEl.addEventListener('touchmove', this.touchmove); | ||
69 | + $scrollEl.addEventListener('touchend', this.touchend); | ||
70 | + } else { | ||
71 | + $scrollEl.addEventListener('scroll', this.throttle(this.scrollEnd, 200)); | ||
72 | + } | ||
65 | }, | 73 | }, |
66 | methods: { | 74 | methods: { |
75 | + touchmove() { | ||
76 | + this.hrefClass['no-link'] = true; | ||
77 | + }, | ||
78 | + touchend() { | ||
79 | + this.hrefClass['no-link'] = false; | ||
80 | + }, | ||
67 | fetch: function() { | 81 | fetch: function() { |
68 | bus.$emit('list.paging'); | 82 | bus.$emit('list.paging'); |
69 | }, | 83 | }, |
@@ -71,7 +85,7 @@ export default { | @@ -71,7 +85,7 @@ export default { | ||
71 | this.$emit('click-product', item, index); | 85 | this.$emit('click-product', item, index); |
72 | }, | 86 | }, |
73 | scrollEnd() { | 87 | scrollEnd() { |
74 | - this.hrefClass = {}; | 88 | + this.hrefClass['no-link'] = false; |
75 | }, | 89 | }, |
76 | getScrollEventTarget(element) { | 90 | getScrollEventTarget(element) { |
77 | let getComputedStyle = document.defaultView.getComputedStyle; | 91 | let getComputedStyle = document.defaultView.getComputedStyle; |
@@ -95,10 +109,7 @@ export default { | @@ -95,10 +109,7 @@ export default { | ||
95 | clearTimeout(timer); | 109 | clearTimeout(timer); |
96 | timer = null; | 110 | timer = null; |
97 | } | 111 | } |
98 | - this.hrefClass = { | ||
99 | - 'no-link': true | ||
100 | - }; | ||
101 | - | 112 | + this.hrefClass['no-link'] = true; |
102 | timer = setTimeout(() => { | 113 | timer = setTimeout(() => { |
103 | fn(); | 114 | fn(); |
104 | }, delay); | 115 | }, delay); |
-
mentioned in commit dbe4a020
-
Please register or login to post a comment