Skip to content
This repository was archived by the owner on Sep 13, 2023. It is now read-only.

Commit 0d7fca5

Browse files
committed
Fix warning: tabWrapper is undefined
1 parent e2cacb4 commit 0d7fca5

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/renderer/components/tab/Tab.vue

+10-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
export default {
55
data: () => ({
66
tabWrapperWidth: null,
7-
tabInnerWith: null,
7+
tabInnerWidth: null,
88
tabSlidesLen: null,
99
tabSlideIndex: 0,
1010
selectedFile: null,
@@ -63,9 +63,16 @@ export default {
6363
6464
recomputeSlidesLen () {
6565
this.$nextTick(() => {
66+
if (this.$refs.tabWrapper === undefined) {
67+
// All the files have been deleted
68+
this.tabSlidesLen = 0;
69+
70+
return;
71+
}
72+
6673
this.tabWrapperWidth = this.$refs.tabWrapper.offsetWidth;
67-
this.tabInnerWith = this.$refs.tabInner.offsetWidth;
68-
this.tabSlidesLen = Math.ceil(this.tabInnerWith / this.tabWrapperWidth) - 1;
74+
this.tabInnerWidth = this.$refs.tabInner.offsetWidth;
75+
this.tabSlidesLen = Math.ceil(this.tabInnerWidth / this.tabWrapperWidth) - 1;
6976
})
7077
}
7178
},

0 commit comments

Comments
 (0)