Authored by 陈峰

商品列表ios灵敏度

... ... @@ -34,6 +34,7 @@ import Vue from 'vue';
import lazyload from 'vue-lazyload';
import infinitScroll from 'vue-infinite-scroll';
import bus from 'common/vue-bus';
import yoho from 'yoho';
Vue.use(lazyload, { preLoad: 3 });
Vue.use(infinitScroll);
... ... @@ -41,7 +42,9 @@ Vue.use(infinitScroll);
export default {
data() {
return {
hrefClass: {}
hrefClass: {
'no-link': false
}
};
},
props: {
... ... @@ -61,9 +64,20 @@ export default {
mounted() {
const $scrollEl = this.getScrollEventTarget(this.$el);
$scrollEl.addEventListener('scroll', this.throttle(this.scrollEnd, 200));
if (yoho.isiOS) {
$scrollEl.addEventListener('touchmove', this.touchmove);
$scrollEl.addEventListener('touchend', this.touchend);
} else {
$scrollEl.addEventListener('scroll', this.throttle(this.scrollEnd, 200));
}
},
methods: {
touchmove() {
this.hrefClass['no-link'] = true;
},
touchend() {
this.hrefClass['no-link'] = false;
},
fetch: function() {
bus.$emit('list.paging');
},
... ... @@ -71,7 +85,7 @@ export default {
this.$emit('click-product', item, index);
},
scrollEnd() {
this.hrefClass = {};
this.hrefClass['no-link'] = false;
},
getScrollEventTarget(element) {
let getComputedStyle = document.defaultView.getComputedStyle;
... ... @@ -95,10 +109,7 @@ export default {
clearTimeout(timer);
timer = null;
}
this.hrefClass = {
'no-link': true
};
this.hrefClass['no-link'] = true;
timer = setTimeout(() => {
fn();
}, delay);
... ...