From 9e85569692e57f51ae0c4a348e0a54ee5d79102b Mon Sep 17 00:00:00 2001 From: wangnan Date: Tue, 12 Mar 2019 10:16:42 +0800 Subject: [PATCH 1/2] update skeleton --- src/packages/swiper/swiper.vue | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/packages/swiper/swiper.vue b/src/packages/swiper/swiper.vue index c16197fa1a..e43091d5e5 100644 --- a/src/packages/swiper/swiper.vue +++ b/src/packages/swiper/swiper.vue @@ -201,9 +201,14 @@ export default { }, _onTouchMove(e){ if(!this.dragging) return; - this.delta = this._getTouchPos(e) - this.startPos; - let isQuickAction = (new Date().getTime() - this.startTime) < 200; - if(this.canDragging && !isQuickAction){ + if(this.isHorizontal()){ + this.delta = this._getTouchPos(e).x - this.startPos.x; + }else{ + this.delta = this._getTouchPos(e).y - this.startPos.y; + } + //let isQuickAction = (new Date().getTime() - this.startTime) < 200; + if(this.canDragging && this._computePreventDefault(e)){ + e.preventDefault(); this.lazyLoad && this._imgLazyLoad(); this._setTranslate(this.startTranslate + this.delta); this.$emit('slideMove',this._getTranslate(),this.$el); @@ -228,10 +233,23 @@ export default { }, _revert(){ this.setPage(this.currentPage,true); + }, + _computePreventDefault(e){ + let pos = this._getTouchPos(e); + let xDis = Math.abs(this.startPos.x - pos.x); + let yDis = Math.abs(this.startPos.y - pos.y); + if ( xDis <= 5 && xDis >=0){ + return false; + }else if( yDis > 5 && yDis/xDis > 0.5 ){ + return false; + }else{ + return true; + } }, _getTouchPos(e){ - let key = this.isHorizontal() ?'pageX':'pageY'; - return e.changedTouches ? e.changedTouches[0][key] :e[key]; + let x = e.changedTouches ? e.changedTouches[0]['pageX'] :e['pageX']; + let y = e.changedTouches ? e.changedTouches[0]['pageY'] :e['pageY']; + return {x,y} }, _onTransitionStart(type){ this.transitionDuration = this.speed; From 91fae99febfb8e6a75e66acf287fafa53060c8b7 Mon Sep 17 00:00:00 2001 From: Frans Date: Tue, 12 Mar 2019 10:30:27 +0800 Subject: [PATCH 2/2] update CHANGELOG.md --- CHANGELOG.md | 12 ++++++++++++ package.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09339142c7..000ce61fcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## 2.0.4 + +`2019-3-12` + +* :sparkles: 新增构建CommonJS包 +* :sparkles: 新增倒计时`CountDown`组件 +* :bug: 修复`Rate`组件样式兼容问题 +* :bug: 修复两个组件测试用例问题 +* :zap: 优化`Swiper`组件 +* :zap: 文档增加目录功能 +* :zap: 新增英文版README.md + ## 2.0.3 `2019-1-25` diff --git a/package.json b/package.json index 7a382a2ad0..7de3949c35 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nutui/nutui", - "version": "2.0.3", + "version": "2.0.4", "description": "一套轻量级移动端Vue组件库", "typings": "dist/types/index.d.ts", "main": "dist/nutui.js",