From e8c83d0491a78cf47caa1f640d9191fad7b05fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20TOUZY?= Date: Wed, 7 Dec 2016 21:48:33 +0100 Subject: [PATCH] fix undefined object.values method and emit @change event (#167) * [fix] Object.values() not supported in IE/Safari #165 * [fix] mdTabs emit change event #168 * change var to let --- src/components/mdTabs/mdTabs.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/mdTabs/mdTabs.vue b/src/components/mdTabs/mdTabs.vue index 7e76eeb..112309e 100644 --- a/src/components/mdTabs/mdTabs.vue +++ b/src/components/mdTabs/mdTabs.vue @@ -152,10 +152,15 @@ this.contentWidth = width * this.activeTabNumber + 'px'; - Object.values(this.tabList).forEach((tab, index) => { + let index = 0; + + for (const tabId in this.tabList) { + let tab = this.tabList[tabId]; + tab.ref.width = width + 'px'; tab.ref.left = width * index + 'px'; - }); + index++; + } }, calculateContentHeight() { this.$nextTick(() => { @@ -189,6 +194,7 @@ this.activeTab = tabData.id; this.activeTabNumber = this.getTabIndex(this.activeTab); this.calculatePosition(); + this.$emit('change', this.activeTabNumber); } }, mounted() {