From d77a240a499b6e2653c8bfa822f6240f366204e7 Mon Sep 17 00:00:00 2001 From: neverland Date: Sat, 22 Dec 2018 08:38:54 +0800 Subject: [PATCH] [bugfix] Tab: log error when all tab disabled (#2356) --- packages/tabs/index.vue | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/tabs/index.vue b/packages/tabs/index.vue index 3bdc3a94d..effefd50f 100644 --- a/packages/tabs/index.vue +++ b/packages/tabs/index.vue @@ -293,7 +293,7 @@ export default create({ this.$nextTick(() => { const { tabs } = this.$refs; - if (!tabs || this.type !== 'line') { + if (!tabs || !tabs[this.curActive] || this.type !== 'line') { return; } @@ -357,14 +357,13 @@ export default create({ scrollIntoView(immediate) { const { tabs } = this.$refs; - if (!this.scrollable || !tabs) { + if (!this.scrollable || !tabs || !tabs[this.curActive]) { return; } - const tab = tabs[this.curActive]; const { nav } = this.$refs; const { scrollLeft, offsetWidth: navWidth } = nav; - const { offsetLeft, offsetWidth: tabWidth } = tab; + const { offsetLeft, offsetWidth: tabWidth } = tabs[this.curActive]; this.scrollTo(nav, scrollLeft, offsetLeft - (navWidth - tabWidth) / 2, immediate); },