mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 21:48:42 +08:00
docs(pullToRefresh): update docs
This commit is contained in:
@ -81,54 +81,154 @@ import {raf, ready, CSS} from '../../util/dom';
|
|||||||
directives: [NgIf, NgClass, Icon]
|
directives: [NgIf, NgClass, Icon]
|
||||||
})
|
})
|
||||||
export class Refresher {
|
export class Refresher {
|
||||||
private ele: HTMLElement;
|
private _ele: HTMLElement;
|
||||||
private _touchMoveListener;
|
private _touchMoveListener;
|
||||||
private _touchEndListener;
|
private _touchEndListener;
|
||||||
private _handleScrollListener;
|
private _handleScrollListener;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
isDragging: boolean = false;
|
isDragging: boolean = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
isOverscrolling: boolean = false;
|
isOverscrolling: boolean = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
dragOffset: number = 0;
|
dragOffset: number = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
lastOverscroll: number = 0;
|
lastOverscroll: number = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
ptrThreshold: number = 0;
|
ptrThreshold: number = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
activated: boolean = false;
|
activated: boolean = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
scrollTime: number = 500;
|
scrollTime: number = 500;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
canOverscroll: boolean = true;
|
canOverscroll: boolean = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
startY;
|
startY;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
deltaY;
|
deltaY;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
scrollHost;
|
scrollHost;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
scrollChild;
|
scrollChild;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
showIcon: boolean;
|
showIcon: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
showSpinner: boolean;
|
showSpinner: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
isRefreshing: boolean;
|
isRefreshing: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
isRefreshingTail: boolean;
|
isRefreshingTail: boolean;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
@Input() pullingIcon: string;
|
@Input() pullingIcon: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
@Input() pullingText: string;
|
@Input() pullingText: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
@Input() refreshingIcon: string;
|
@Input() refreshingIcon: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
@Input() refreshingText: string;
|
@Input() refreshingText: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
@Input() spinner: string;
|
@Input() spinner: string;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
@Output() pulling: EventEmitter<any> = new EventEmitter();
|
@Output() pulling: EventEmitter<any> = new EventEmitter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
@Output() refresh: EventEmitter<any> = new EventEmitter();
|
@Output() refresh: EventEmitter<any> = new EventEmitter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
@Output() starting: EventEmitter<any> = new EventEmitter();
|
@Output() starting: EventEmitter<any> = new EventEmitter();
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Host() private content: Content,
|
@Host() private _content: Content,
|
||||||
element: ElementRef
|
_element: ElementRef
|
||||||
) {
|
) {
|
||||||
this.ele = element.nativeElement;
|
this._ele = _element.nativeElement;
|
||||||
this.ele.classList.add('content');
|
this._ele.classList.add('content');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
let sp = this.content.getNativeElement();
|
let sp = this._content.getNativeElement();
|
||||||
let sc = this.content.scrollElement;
|
let sc = this._content.scrollElement;
|
||||||
|
|
||||||
this.startY = null;
|
this.startY = null;
|
||||||
this.deltaY = null;
|
this.deltaY = null;
|
||||||
@ -156,7 +256,7 @@ export class Refresher {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
let sc = this.content.scrollElement;
|
let sc = this._content.scrollElement;
|
||||||
sc.removeEventListener('touchmove', this._touchMoveListener);
|
sc.removeEventListener('touchmove', this._touchMoveListener);
|
||||||
sc.removeEventListener('touchend', this._touchEndListener);
|
sc.removeEventListener('touchend', this._touchEndListener);
|
||||||
sc.removeEventListener('scroll', this._handleScrollListener);
|
sc.removeEventListener('scroll', this._handleScrollListener);
|
||||||
@ -245,7 +345,7 @@ export class Refresher {
|
|||||||
*/
|
*/
|
||||||
show() {
|
show() {
|
||||||
// showCallback
|
// showCallback
|
||||||
this.ele.classList.remove('invisible');
|
this._ele.classList.remove('invisible');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -253,7 +353,7 @@ export class Refresher {
|
|||||||
*/
|
*/
|
||||||
hide() {
|
hide() {
|
||||||
// showCallback
|
// showCallback
|
||||||
this.ele.classList.add('invisible');
|
this._ele.classList.add('invisible');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -261,7 +361,7 @@ export class Refresher {
|
|||||||
*/
|
*/
|
||||||
tail() {
|
tail() {
|
||||||
// tailCallback
|
// tailCallback
|
||||||
this.ele.classList.add('refreshing-tail');
|
this._ele.classList.add('refreshing-tail');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user