使用ListView组件的onScrollToEnd事件来实现无限滚动的列表。@Entry @Component struct InfiniteScrollListAbility { @State private items: string[] = []; build() { Column() { ListView(this.items) .itemCreator((item) => Text(item).fontSize(18)) .itemSize(50) .onScrollToEnd(() => { this.loadMoreItems(); }); } } private loadMoreItems() { // Simulate loading more items const newItems = ['Item ' + (this.items.length + 1), 'Item ' + (this.items.length + 2)]; this.items = [...this.items, ...newItems]; } }参见:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides...本文参与了 【 HarmonyOS NEXT 技术问答冲榜,等你来战!】欢迎正在阅读的你也加入。
使用ListView组件的onScrollToEnd事件来实现无限滚动的列表。
参见:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides...
本文参与了 【 HarmonyOS NEXT 技术问答冲榜,等你来战!】欢迎正在阅读的你也加入。