Commit 75798f5b0c27dc2bb4fc64fb5ed53ebe3880906c

Authored by erhuluanzi
1 parent 06290cb3

getComputedStyle在IE中不能正确获取元素的宽度,改为通过offsetWidth获取,修正tabs的高亮下划线在IE中错位的问题

Showing 1 changed file with 2 additions and 2 deletions   Show diff stats
src/components/tabs/tabs.vue
@@ -150,13 +150,13 @@ @@ -150,13 +150,13 @@
150 const index = this.navList.findIndex((nav) => nav.name === this.activeKey); 150 const index = this.navList.findIndex((nav) => nav.name === this.activeKey);
151 const prevTabs = this.$refs.nav.querySelectorAll(`.${prefixCls}-tab`); 151 const prevTabs = this.$refs.nav.querySelectorAll(`.${prefixCls}-tab`);
152 const tab = prevTabs[index]; 152 const tab = prevTabs[index];
153 - this.barWidth = parseFloat(getStyle(tab, 'width')); 153 + this.barWidth = parseFloat(tab.offsetWidth);
154 154
155 if (index > 0) { 155 if (index > 0) {
156 let offset = 0; 156 let offset = 0;
157 const gutter = this.size === 'small' ? 0 : 16; 157 const gutter = this.size === 'small' ? 0 : 16;
158 for (let i = 0; i < index; i++) { 158 for (let i = 0; i < index; i++) {
159 - offset += parseFloat(getStyle(prevTabs[i], 'width')) + gutter; 159 + offset += parseFloat(prevTabs[i].offsetWidth) + gutter;
160 } 160 }
161 161
162 this.barOffset = offset; 162 this.barOffset = offset;