From 75798f5b0c27dc2bb4fc64fb5ed53ebe3880906c Mon Sep 17 00:00:00 2001 From: erhuluanzi Date: Sun, 6 Aug 2017 16:25:43 +0800 Subject: [PATCH] getComputedStyle在IE中不能正确获取元素的宽度,改为通过offsetWidth获取,修正tabs的高亮下划线在IE中错位的问题 --- src/components/tabs/tabs.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/tabs/tabs.vue b/src/components/tabs/tabs.vue index dcc1d63..372ccc5 100644 --- a/src/components/tabs/tabs.vue +++ b/src/components/tabs/tabs.vue @@ -150,13 +150,13 @@ const index = this.navList.findIndex((nav) => nav.name === this.activeKey); const prevTabs = this.$refs.nav.querySelectorAll(`.${prefixCls}-tab`); const tab = prevTabs[index]; - this.barWidth = parseFloat(getStyle(tab, 'width')); + this.barWidth = parseFloat(tab.offsetWidth); if (index > 0) { let offset = 0; const gutter = this.size === 'small' ? 0 : 16; for (let i = 0; i < index; i++) { - offset += parseFloat(getStyle(prevTabs[i], 'width')) + gutter; + offset += parseFloat(prevTabs[i].offsetWidth) + gutter; } this.barOffset = offset; -- libgit2 0.21.4