From 0be742d167b449e7ad685c431e9ae3760058934c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Fri, 13 Dec 2019 14:33:24 +0800 Subject: [PATCH] flow layout demo load more --- src/FlowLayoutDemo.ts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) 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) }