Commit 75798f5b0c27dc2bb4fc64fb5ed53ebe3880906c
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 | 150 | const index = this.navList.findIndex((nav) => nav.name === this.activeKey); |
151 | 151 | const prevTabs = this.$refs.nav.querySelectorAll(`.${prefixCls}-tab`); |
152 | 152 | const tab = prevTabs[index]; |
153 | - this.barWidth = parseFloat(getStyle(tab, 'width')); | |
153 | + this.barWidth = parseFloat(tab.offsetWidth); | |
154 | 154 | |
155 | 155 | if (index > 0) { |
156 | 156 | let offset = 0; |
157 | 157 | const gutter = this.size === 'small' ? 0 : 16; |
158 | 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 | 162 | this.barOffset = offset; |
... | ... |