flow layout demo load more

This commit is contained in:
王劲鹏 2019-12-13 14:33:24 +08:00
parent 4569e6416a
commit 0be742d167

View File

@ -17,7 +17,7 @@ class FlowDemo extends Panel {
build(rootView: Group): void { build(rootView: Group): void {
flowlayout({ flowlayout({
layoutConfig: layoutConfig().atmost(), layoutConfig: layoutConfig().atmost(),
itemCount: 500, itemCount: 100,
columnCount: 3, columnCount: 3,
columnSpace: 10, columnSpace: 10,
rowSpace: 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) .in(rootView)
} }