Skip to content

Commit

Permalink
Merge branch 'v2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Franslee committed Mar 12, 2019
2 parents 58151fb + 666f841 commit c2cacf5
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
28 changes: 23 additions & 5 deletions src/packages/swiper/swiper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit c2cacf5

Please sign in to comment.