Skip to content

Commit f117ccb

Browse files
authored
fix(module:carousel): wrong dot postion when placement is left or right (#9358)
1 parent 72241ca commit f117ccb

1 file changed

Lines changed: 10 additions & 19 deletions

File tree

components/carousel/carousel.component.ts

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
ChangeDetectorRef,
1515
Component,
1616
ContentChildren,
17+
DestroyRef,
1718
ElementRef,
1819
EventEmitter,
1920
Input,
@@ -29,8 +30,7 @@ import {
2930
ViewEncapsulation,
3031
booleanAttribute,
3132
inject,
32-
numberAttribute,
33-
DestroyRef
33+
numberAttribute
3434
} from '@angular/core';
3535
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
3636
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
@@ -142,19 +142,7 @@ export class NzCarouselComponent implements AfterContentInit, AfterViewInit, OnC
142142
*/
143143
@Input() nzStrategyOptions: NzSafeAny = undefined;
144144

145-
@Input()
146-
// @ts-ignore
147-
@WithConfig()
148-
set nzDotPosition(value: NzCarouselDotPosition) {
149-
this._dotPosition = value;
150-
this.vertical = value === 'left' || value === 'right';
151-
}
152-
153-
get nzDotPosition(): NzCarouselDotPosition {
154-
return this._dotPosition;
155-
}
156-
157-
private _dotPosition: NzCarouselDotPosition = 'bottom';
145+
@Input() @WithConfig() nzDotPosition: NzCarouselDotPosition = 'bottom';
158146

159147
@Output() readonly nzBeforeChange = new EventEmitter<FromToInterface>();
160148
@Output() readonly nzAfterChange = new EventEmitter<number>();
@@ -256,10 +244,13 @@ export class NzCarouselComponent implements AfterContentInit, AfterViewInit, OnC
256244
this.layout();
257245
}
258246

259-
if (nzDotPosition && !nzDotPosition.isFirstChange()) {
260-
this.switchStrategy();
261-
this.markContentActive(0);
262-
this.layout();
247+
if (nzDotPosition) {
248+
this.vertical = nzDotPosition.currentValue === 'left' || nzDotPosition.currentValue === 'right';
249+
if (!nzDotPosition.isFirstChange()) {
250+
this.switchStrategy();
251+
this.markContentActive(0);
252+
this.layout();
253+
}
263254
}
264255

265256
if (!this.nzAutoPlay || !this.nzAutoPlaySpeed) {

0 commit comments

Comments
 (0)