Skip to content

Commit 004eb99

Browse files
committed
recalculate width of actions on start
1 parent 50224a0 commit 004eb99

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/components/SwipeOut.vue

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,21 @@
4040
hasRight: 'right' in this.$slots,
4141
leftOpen: false,
4242
rightOpen: false,
43+
leftActionsWidth: 0,
44+
rightActionsWidth: 0,
4345
};
4446
},
4547
props: {
4648
threshold: {
4749
type: Number,
4850
default: 45,
49-
},
51+
},
5052
},
5153
mounted() {
5254
if (!this.hasLeft && !this.hasRight)
5355
return;
5456
this._createHammer();
5557
},
56-
computed: {
57-
leftActionsWidth() {
58-
return this.$refs.left ? this.$refs.left.clientWidth : 0;
59-
},
60-
rightActionsWidth() {
61-
return this.$refs.right ? this.$refs.right.clientWidth : 0;
62-
},
63-
},
6458
beforeDestroy() {
6559
if (this.hammer)
6660
this.hammer.destroy();
@@ -139,6 +133,9 @@
139133
_startListener(event) {
140134
this.isTransitioning = false;
141135
if (event.deltaY >= -5 && event.deltaY <= 5) {
136+
this.leftActionsWidth = this.$refs.left ? this.$refs.left.clientWidth : 0;
137+
this.rightActionsWidth = this.$refs.right ? this.$refs.right.clientWidth : 0;
138+
142139
this.startLeft = this._distanceSwiped();
143140
this.isActive = true;
144141

0 commit comments

Comments
 (0)