Commit 7b0486680bd1018cecad87560fb770348cb3b2d9
Committed by
GitHub
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 | 24 | <script> |
25 | 25 | import Icon from '../icon/icon.vue'; |
26 | 26 | import Render from '../base/render'; |
27 | - import { oneOf, getStyle } from '../../utils/assist'; | |
27 | + import { oneOf } from '../../utils/assist'; | |
28 | 28 | import Emitter from '../../mixins/emitter'; |
29 | 29 | |
30 | 30 | const prefixCls = 'ivu-tabs'; |
... | ... | @@ -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; | ... | ... |