Skip to content

Commit

Permalink
fix(module: carousel): fix carousel selectedIndex init work error (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
Guoyuanqiang authored and fisherspy committed Jan 9, 2019
1 parent 9a9988a commit 5482cb2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/carousel/carousel.component.ts
Expand Up @@ -465,7 +465,7 @@ export class CarouselComponent implements AfterViewInit, OnDestroy {
this.carouselInit(items);
});
this.initCarouselSize();
this.getListStyles();
this.getListStyles(-this.selectedIndex * this._rationWidth);
this.carouselInit(this.items);
const nativeElement = this._ele.nativeElement;
const targetNode = nativeElement.querySelector('carouselslide');
Expand All @@ -475,7 +475,7 @@ export class CarouselComponent implements AfterViewInit, OnDestroy {
if (mutation.type == 'attributes') {
if (this.slideHeight !== nativeElement.querySelector('carouselslide').clientHeight) {
this.initCarouselSize();
this.getListStyles();
this.getListStyles(-this.selectedIndex * this._rationWidth);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions components/carousel/demo/basic.ts
Expand Up @@ -6,6 +6,7 @@ import { Component } from '@angular/core';
<WingBlank>
<Carousel [infinite]="true"
[vertical]="false"
[selectedIndex]="1"
(beforeChange)="beforeChange($event)"
(afterChange)="afterChange($event)"
>
Expand Down

0 comments on commit 5482cb2

Please sign in to comment.