[improvement] SwipeCell: fix typo and adjust swipeLeaveTransition method's parameter values (#3048)

This commit is contained in:
流采
2019-03-24 20:43:46 +08:00
committed by neverland
parent 4d85e56d83
commit 76a90eb89e
3 changed files with 33 additions and 12 deletions
+10 -9
View File
@@ -21,7 +21,7 @@ export default sfc({
data() {
return {
offset: 0,
draging: false
dragging: false
};
},
@@ -55,13 +55,14 @@ export default sfc({
const threshold = this.opened ? 1 - THRESHOLD : THRESHOLD;
// right
if (direction > 0 && -offset > rightWidth * threshold && rightWidth > 0) {
if (direction === 'right' && -offset > rightWidth * threshold && rightWidth > 0) {
this.open('right');
// left
} else if (direction < 0 && offset > leftWidth * threshold && leftWidth > 0) {
} else if (direction === 'left' && offset > leftWidth * threshold && leftWidth > 0) {
this.open('left');
// reset
} else {
this.swipeMove();
this.swipeMove(0);
}
},
@@ -70,7 +71,7 @@ export default sfc({
return;
}
this.draging = true;
this.dragging = true;
this.touchStart(event);
if (this.opened) {
@@ -96,9 +97,9 @@ export default sfc({
return;
}
this.draging = false;
this.dragging = false;
if (this.swiping) {
this.swipeLeaveTransition(this.offset > 0 ? -1 : 1);
this.swipeLeaveTransition(this.offset > 0 ? 'left' : 'right');
}
},
@@ -127,7 +128,7 @@ export default sfc({
const wrapperStyle = {
transform: `translate3d(${this.offset}px, 0, 0)`,
transition: this.draging ? 'none' : '.6s cubic-bezier(0.18, 0.89, 0.32, 1)'
transition: this.dragging ? 'none' : '.6s cubic-bezier(0.18, 0.89, 0.32, 1)'
};
return (
@@ -143,7 +144,7 @@ export default sfc({
class={bem('wrapper')}
style={wrapperStyle}
onTransitionend={() => {
this.swipe = false;
this.swiping = false;
}}
>
{this.leftWidth ? (