getComputedStyle在IE中不能正确获取元素的宽度,改为通过offsetWidth获取,修正tabs的高亮下划线在IE中错位的问题
This commit is contained in:
parent
06290cb3a9
commit
75798f5b0c
1 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue