Authored by yyq

fix

... ... @@ -102,46 +102,9 @@ export default {
},
mounted() {
this.fetchCommentsEvent = throttle(this.fetchComments.bind(this), 1500);
this.$el.addEventListener('touchstart', this.onTouchStart, false);
this.$el.addEventListener('touchmove', this.onTouchMove, false);
this.$el.addEventListener('touchend', this.onTouchEnd, false);
},
beforeDestroy() {
this.$el.removeEventListener('touchstart', this.onTouchStart);
this.$el.removeEventListener('touchmove', this.onTouchMove);
this.$el.removeEventListener('touchend', this.onTouchEnd);
},
methods: {
...mapActions(['fetchCommentList', 'fetchReplayList', 'postComment']),
onTouchStart(e) {
this._lastTouch = {
startTime: get(e, 'timeStamp'),
startY: get(e, 'targetTouches[0].clientY'),
canHide: this.scrollY < 6
};
},
onTouchMove(e) {
let moveY = get(e, 'targetTouches[0].clientY');
if (this._lastTouch) {
this._lastTouch.moveY = moveY;
if (moveY - this._lastTouch.startY < -10) {
this._lastTouch.canHide = false;
}
}
},
onTouchEnd(e) {
const lastTouch = {...this._lastTouch};
this._lastTouch = {};
if (lastTouch.canHide &&
e.timeStamp - lastTouch.startTime < 500 &&
lastTouch.moveY - lastTouch.startY > 300) {
this.onClose();
}
},
async fetchCommentsAsync(pre) {
let params = {
destId: this.destId,
... ...