diff --git a/src/FlowLayoutDemo.ts b/src/FlowLayoutDemo.ts index f668cc08..5bc11e37 100644 --- a/src/FlowLayoutDemo.ts +++ b/src/FlowLayoutDemo.ts @@ -17,7 +17,7 @@ class FlowDemo extends Panel { build(rootView: Group): void { flowlayout({ layoutConfig: layoutConfig().atmost(), - itemCount: 500, + itemCount: 100, columnCount: 3, columnSpace: 10, rowSpace: 10, @@ -35,6 +35,25 @@ class FlowDemo extends Panel { })) }) }, + }).also(it => { + it.loadMore = true + it.onLoadMore = () => { + setTimeout(() => { + it.itemCount += 20 + }, 1000) + } + it.loadMoreView = new FlowLayoutItem().apply({ + backgroundColor: colors[500 % colors.length], + height: 50, + layoutConfig: layoutConfig().w(LayoutSpec.AT_MOST), + }).also(it => { + it.addChild(text({ + text: 'load more', + textColor: Color.WHITE, + textSize: 20, + layoutConfig: layoutConfig().wrap().a(Gravity.Center) + })) + }) }) .in(rootView) }