Commit 7b0486680bd1018cecad87560fb770348cb3b2d9

Authored by Aresn
Committed by GitHub
2 parents 60314959 13261a8b

Merge pull request #1546 from TabEnter/2.0

fix #695
Showing 1 changed file with 3 additions and 3 deletions   Show diff stats
src/components/tabs/tabs.vue
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 <script> 24 <script>
25 import Icon from '../icon/icon.vue'; 25 import Icon from '../icon/icon.vue';
26 import Render from '../base/render'; 26 import Render from '../base/render';
27 - import { oneOf, getStyle } from '../../utils/assist'; 27 + import { oneOf } from '../../utils/assist';
28 import Emitter from '../../mixins/emitter'; 28 import Emitter from '../../mixins/emitter';
29 29
30 const prefixCls = 'ivu-tabs'; 30 const prefixCls = 'ivu-tabs';
@@ -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;