mirror of
https://github.com/youzan/vant.git
synced 2025-10-22 11:54:02 +00:00
[Improvement] CellSwipe: add open method (#1546)
This commit is contained in:
@@ -69,6 +69,12 @@ export default create({
|
||||
},
|
||||
|
||||
methods: {
|
||||
open(position) {
|
||||
const offset = position === 'left' ? this.leftWidth : -this.rightWidth;
|
||||
this.swipeMove(offset);
|
||||
this.resetSwipeStatus();
|
||||
},
|
||||
|
||||
close() {
|
||||
this.offset = 0;
|
||||
},
|
||||
@@ -90,12 +96,10 @@ export default create({
|
||||
|
||||
// right
|
||||
if (direction > 0 && -offset > rightWidth * threshold && rightWidth > 0) {
|
||||
this.swipeMove(-rightWidth);
|
||||
this.resetSwipeStatus();
|
||||
this.open('right');
|
||||
// left
|
||||
} else if (direction < 0 && offset > leftWidth * threshold && leftWidth > 0) {
|
||||
this.swipeMove(leftWidth);
|
||||
this.resetSwipeStatus();
|
||||
this.open('left');
|
||||
} else {
|
||||
this.swipeMove();
|
||||
}
|
||||
|
Reference in New Issue
Block a user