flowlayout add header and footer:js and android implement

This commit is contained in:
pengfei.zhou
2021-10-11 11:14:55 +08:00
committed by osborn
parent 5224be8f90
commit 5ad4f4b981
12 changed files with 208 additions and 32 deletions

View File

@@ -29,11 +29,17 @@ export class FlowLayout extends Superview {
private cachedViews: Map<string, FlowLayoutItem> = new Map
allSubviews() {
const ret = [...this.cachedViews.values()]
if (this.loadMoreView) {
return [...this.cachedViews.values(), this.loadMoreView]
} else {
return this.cachedViews.values()
ret.push(this.loadMoreView)
}
if (this.header) {
ret.push(this.header)
}
if (this.footer) {
ret.push(this.footer)
}
return ret
}
@Property
@@ -77,6 +83,12 @@ export class FlowLayout extends Superview {
@Property
bounces?: boolean
@Property
header?: FlowLayoutItem
@Property
footer?: FlowLayoutItem
reset() {
this.cachedViews.clear()
this.itemCount = 0
@@ -98,6 +110,12 @@ export class FlowLayout extends Superview {
if (this.loadMoreView) {
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId
}
if (this.header) {
this.dirtyProps['header'] = this.header.viewId
}
if (this.footer) {
this.dirtyProps['footer'] = this.footer.viewId
}
return super.toModel()
}
}