mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00
fix(slides): add id to the slide component to grab the correct pagination
fixes #5745 references #5508
This commit is contained in:
@ -72,6 +72,9 @@ import {Scroll} from '../scroll/scroll';
|
|||||||
'<div [class.hide]="!showPager" class="swiper-pagination"></div>' +
|
'<div [class.hide]="!showPager" class="swiper-pagination"></div>' +
|
||||||
'</div>',
|
'</div>',
|
||||||
directives: [NgClass],
|
directives: [NgClass],
|
||||||
|
host: {
|
||||||
|
'[id]': 'slideId'
|
||||||
|
},
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
})
|
})
|
||||||
@ -82,6 +85,16 @@ export class Slides extends Ion {
|
|||||||
*/
|
*/
|
||||||
public rapidUpdate: Function;
|
public rapidUpdate: Function;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private id: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private slideId: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@ -204,6 +217,9 @@ export class Slides extends Ion {
|
|||||||
this.rapidUpdate = debounce(() => {
|
this.rapidUpdate = debounce(() => {
|
||||||
this.update();
|
this.update();
|
||||||
}, 10);
|
}, 10);
|
||||||
|
|
||||||
|
this.id = ++slidesId;
|
||||||
|
this.slideId = 'slides-' + this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -216,8 +232,10 @@ export class Slides extends Ion {
|
|||||||
|
|
||||||
this.showPager = isTrueProperty(this.pager);
|
this.showPager = isTrueProperty(this.pager);
|
||||||
|
|
||||||
|
let paginationId = '#' + this.slideId + ' .swiper-pagination';
|
||||||
|
|
||||||
var options = defaults({
|
var options = defaults({
|
||||||
pagination: '.swiper-pagination',
|
pagination: paginationId,
|
||||||
}, this.options);
|
}, this.options);
|
||||||
|
|
||||||
options.onTap = (swiper, e) => {
|
options.onTap = (swiper, e) => {
|
||||||
@ -706,3 +724,5 @@ export class Slide {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
export class SlideLazy {}
|
export class SlideLazy {}
|
||||||
|
|
||||||
|
let slidesId = -1;
|
||||||
|
Reference in New Issue
Block a user