Skip to content

Commit

Permalink
fix(module:tabs): unable get offsetWidth & offsetHeight when setInkBa…
Browse files Browse the repository at this point in the history
…rStatus at first time sometime (NG-ZORRO#7)
  • Loading branch information
Shandawei authored and fisherspy committed Oct 8, 2018
1 parent 6d65ebb commit 6502082
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions components/tabs/default-tab-bar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,17 @@ export class DefaultTabBarComponent implements AfterViewInit {
if (this.tabTitles && this.tabTitles.length > 0) {
if ('top' === this.tabBarPosition || 'bottom' === this.tabBarPosition) {
this.inkBarOffSet = this.tabTitles.toArray()[key].nativeElement.offsetLeft;
this.inkBarLength = this.tabTitles.toArray()[key].nativeElement.offsetWidth;
this.inkBarLength = this.tabTitles.toArray()[key].nativeElement.style.width;
this.inkBarStyle = {
width: this.inkBarLength + 'px',
width: this.inkBarLength,
left: (this.selectedKey * 100) / this.page + '%'
};
Object.assign(this.inkBarStyle, this.tabBarUnderlineStyle);
} else {
this.inkBarOffSet = this.tabTitles.toArray()[key].nativeElement.offsetTop;
this.inkBarLength = this.tabTitles.toArray()[key].nativeElement.offsetHeight;
this.inkBarLength = this.tabTitles.toArray()[key].nativeElement.style.height;
this.inkBarStyle = {
height: this.inkBarLength + 'px',
height: this.inkBarLength,
top: (this.selectedKey * 100) / this.page + '%'
};
Object.assign(this.inkBarStyle, this.tabBarUnderlineStyle);
Expand Down

0 comments on commit 6502082

Please sign in to comment.