getData(index: number): T | LoadingMoreItem {
if (0 <= index && index < this.length)
return this[index];
if (!this.hasMore) {
return new NoMoreLoadItem();
}
else if (this.indicatorStatus == IndicatorStatus.loadingMoreError) {
return new LoadingMoreErrorItem();
}
else {
// auto load more
if (this.indicatorStatus != IndicatorStatus.loadingMoreBusying) {
this.loadMore();
}
return new LoadingMoreBusyingItem();
}
}
```
@Component
export struct CustomIndicatorWidget {
/// Source list based on the [LoadingMoreBase].
indicatorStatus: IndicatorStatus;
sourceList: LoadingMoreBase<any>;
getData(index: number): T | LoadingMoreItem {
if (0 <= index && index < this.length)
return this[index];
if (!this.hasMore) {
return new NoMoreLoadItem();
}
else if (this.indicatorStatus == IndicatorStatus.loadingMoreError) {
return new LoadingMoreErrorItem();
}
else {
// auto load more
if (this.indicatorStatus != IndicatorStatus.loadingMoreBusying) {
this.loadMore();
}
return new LoadingMoreBusyingItem();
}
}
}
```