mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 10:01:59 +08:00
feat(swiper): expose full API (#19137)
* expose full swiper API * update types * run build * run angular build
This commit is contained in:
@ -807,7 +807,7 @@ export class IonSlides {
|
|||||||
proxyOutputs(this, this.el, ['ionSlidesDidLoad', 'ionSlideTap', 'ionSlideDoubleTap', 'ionSlideWillChange', 'ionSlideDidChange', 'ionSlideNextStart', 'ionSlidePrevStart', 'ionSlideNextEnd', 'ionSlidePrevEnd', 'ionSlideTransitionStart', 'ionSlideTransitionEnd', 'ionSlideDrag', 'ionSlideReachStart', 'ionSlideReachEnd', 'ionSlideTouchStart', 'ionSlideTouchEnd']);
|
proxyOutputs(this, this.el, ['ionSlidesDidLoad', 'ionSlideTap', 'ionSlideDoubleTap', 'ionSlideWillChange', 'ionSlideDidChange', 'ionSlideNextStart', 'ionSlidePrevStart', 'ionSlideNextEnd', 'ionSlidePrevEnd', 'ionSlideTransitionStart', 'ionSlideTransitionEnd', 'ionSlideDrag', 'ionSlideReachStart', 'ionSlideReachEnd', 'ionSlideTouchStart', 'ionSlideTouchEnd']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
proxyMethods(IonSlides, ['update', 'updateAutoHeight', 'slideTo', 'slideNext', 'slidePrev', 'getActiveIndex', 'getPreviousIndex', 'length', 'isEnd', 'isBeginning', 'startAutoplay', 'stopAutoplay', 'lockSwipeToNext', 'lockSwipeToPrev', 'lockSwipes']);
|
proxyMethods(IonSlides, ['update', 'updateAutoHeight', 'slideTo', 'slideNext', 'slidePrev', 'getActiveIndex', 'getPreviousIndex', 'length', 'isEnd', 'isBeginning', 'startAutoplay', 'stopAutoplay', 'lockSwipeToNext', 'lockSwipeToPrev', 'lockSwipes', 'getSwiper']);
|
||||||
proxyInputs(IonSlides, ['mode', 'options', 'pager', 'scrollbar']);
|
proxyInputs(IonSlides, ['mode', 'options', 'pager', 'scrollbar']);
|
||||||
|
|
||||||
export declare interface IonSpinner extends Components.IonSpinner {}
|
export declare interface IonSpinner extends Components.IonSpinner {}
|
||||||
|
@ -1068,6 +1068,7 @@ ion-slides,prop,pager,boolean,false,false,false
|
|||||||
ion-slides,prop,scrollbar,boolean,false,false,false
|
ion-slides,prop,scrollbar,boolean,false,false,false
|
||||||
ion-slides,method,getActiveIndex,getActiveIndex() => Promise<number>
|
ion-slides,method,getActiveIndex,getActiveIndex() => Promise<number>
|
||||||
ion-slides,method,getPreviousIndex,getPreviousIndex() => Promise<number>
|
ion-slides,method,getPreviousIndex,getPreviousIndex() => Promise<number>
|
||||||
|
ion-slides,method,getSwiper,getSwiper() => Promise<any>
|
||||||
ion-slides,method,isBeginning,isBeginning() => Promise<boolean>
|
ion-slides,method,isBeginning,isBeginning() => Promise<boolean>
|
||||||
ion-slides,method,isEnd,isEnd() => Promise<boolean>
|
ion-slides,method,isEnd,isEnd() => Promise<boolean>
|
||||||
ion-slides,method,length,length() => Promise<number>
|
ion-slides,method,length,length() => Promise<number>
|
||||||
|
4
core/src/components.d.ts
vendored
4
core/src/components.d.ts
vendored
@ -2388,6 +2388,10 @@ export namespace Components {
|
|||||||
*/
|
*/
|
||||||
'getPreviousIndex': () => Promise<number>;
|
'getPreviousIndex': () => Promise<number>;
|
||||||
/**
|
/**
|
||||||
|
* Get the Swiper instance. Use this to access the full Swiper API. See https://idangero.us/swiper/api/ for all API options.
|
||||||
|
*/
|
||||||
|
'getSwiper': () => Promise<any>;
|
||||||
|
/**
|
||||||
* Get whether or not the current slide is the first slide.
|
* Get whether or not the current slide is the first slide.
|
||||||
*/
|
*/
|
||||||
'isBeginning': () => Promise<boolean>;
|
'isBeginning': () => Promise<boolean>;
|
||||||
|
@ -614,6 +614,18 @@ Type: `Promise<number>`
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### `getSwiper() => Promise<any>`
|
||||||
|
|
||||||
|
Get the Swiper instance.
|
||||||
|
Use this to access the full Swiper API.
|
||||||
|
See https://idangero.us/swiper/api/ for all API options.
|
||||||
|
|
||||||
|
#### Returns
|
||||||
|
|
||||||
|
Type: `Promise<any>`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### `isBeginning() => Promise<boolean>`
|
### `isBeginning() => Promise<boolean>`
|
||||||
|
|
||||||
Get whether or not the current slide is the first slide.
|
Get whether or not the current slide is the first slide.
|
||||||
|
@ -320,6 +320,16 @@ export class Slides implements ComponentInterface {
|
|||||||
swiper.allowTouchMove = !lock;
|
swiper.allowTouchMove = !lock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Swiper instance.
|
||||||
|
* Use this to access the full Swiper API.
|
||||||
|
* See https://idangero.us/swiper/api/ for all API options.
|
||||||
|
*/
|
||||||
|
@Method()
|
||||||
|
async getSwiper(): Promise<any> {
|
||||||
|
return this.swiper;
|
||||||
|
}
|
||||||
|
|
||||||
private async initSwiper() {
|
private async initSwiper() {
|
||||||
const finalOptions = this.normalizeOptions();
|
const finalOptions = this.normalizeOptions();
|
||||||
|
|
||||||
@ -332,10 +342,6 @@ export class Slides implements ComponentInterface {
|
|||||||
this.readySwiper(swiper);
|
this.readySwiper(swiper);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getSwiper() {
|
|
||||||
return this.swiper;
|
|
||||||
}
|
|
||||||
|
|
||||||
private normalizeOptions(): SwiperOptions {
|
private normalizeOptions(): SwiperOptions {
|
||||||
// Base options, can be changed
|
// Base options, can be changed
|
||||||
// TODO Add interface SwiperOptions
|
// TODO Add interface SwiperOptions
|
||||||
|
Reference in New Issue
Block a user