From ecd40b9641b14f9761f2b3446f445439b4347bca Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Tue, 10 Dec 2019 20:32:17 +0800 Subject: [PATCH] feat:add list onLoadMore --- src/ListDemo.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ListDemo.ts b/src/ListDemo.ts index bd416a0f..b5ec9ee4 100644 --- a/src/ListDemo.ts +++ b/src/ListDemo.ts @@ -1,4 +1,4 @@ -import { Group, Panel, List, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout, Text, refreshable, Refreshable, ListItem } from "doric"; +import { Group, Panel, List, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout, Text, refreshable, Refreshable, ListItem, layoutConfig } from "doric"; import { rotatedArrow, colors } from "./utils"; @Entry class ListPanel extends Panel { @@ -25,6 +25,17 @@ class ListPanel extends Panel { it.reset() offset = Math.ceil(Math.random() * colors.length) it.itemCount = 40 + it.loadMore = true + it.onLoadMore = () => { + setTimeout(() => { + it.itemCount += 10 + }, 1000) + } + it.loadMoreView = listItem(text({ + text: "Loading", + layoutConfig: layoutConfig().atmost().h(LayoutSpec.EXACTLY).a(Gravity.Center), + height: 50, + })) it.renderItem = (idx: number) => { let counter!: Text return listItem(