Skip to content

Commit

Permalink
[修复] tab无法监听selectedIndexChange和selectedChange事件 fixes #708
Browse files Browse the repository at this point in the history
  • Loading branch information
hpyou authored and rdkmaster committed Aug 28, 2018
1 parent 426fbc0 commit 8668855
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/demo/tab/basic/demo.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<!-- start to learn the demo from here -->
<div class="container">
<jigsaw-tabs (selectChange)="testEvent($event)" [selectedIndex]="2" height="200">
<jigsaw-tabs (selectChange)="testEvent($event)" (selectedIndexChange)="selectedIndexChange($event)" [selectedIndex]="2" height="200">
<jigsaw-tab-pane [lazy]="false">
<div jigsaw-title><span class="fa fa-gift"></span>tab 1</div>
<ng-template>tab content 1</ng-template>
Expand Down
4 changes: 4 additions & 0 deletions src/app/demo/tab/basic/demo.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export class JigsawTabsDemoComponent {
console.info(value);
}

selectedIndexChange($event) {
console.log($event);
}

public lineBarGraphData: LineGraphData;

constructor(http: HttpClient) {
Expand Down
3 changes: 2 additions & 1 deletion src/jigsaw/component/tabs/tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,9 @@ export class JigsawTab extends AbstractJigsawComponent implements AfterViewInit,
public _$contentHeight: string = 'auto';

ngOnInit() {
super.ngOnInit();
if(this.height) {
setTimeout(() => {
this.callLater(() => {
// 等待dom渲染
this._$contentHeight = this._elementRef.nativeElement.offsetHeight - 46 + 'px';
})
Expand Down

0 comments on commit 8668855

Please sign in to comment.