feat:web List onScroll callback
This commit is contained in:
parent
089423126d
commit
bb6840cc40
@ -5,6 +5,7 @@ export class DoricListNode extends DoricSuperNode {
|
|||||||
itemCount = 0
|
itemCount = 0
|
||||||
renderItemFuncId?: string
|
renderItemFuncId?: string
|
||||||
onLoadMoreFuncId?: string
|
onLoadMoreFuncId?: string
|
||||||
|
onScrollFuncId?: string
|
||||||
loadMoreViewId?: string
|
loadMoreViewId?: string
|
||||||
batchCount = 15
|
batchCount = 15
|
||||||
loadMore = false
|
loadMore = false
|
||||||
@ -22,6 +23,9 @@ export class DoricListNode extends DoricSuperNode {
|
|||||||
case "onLoadMore":
|
case "onLoadMore":
|
||||||
this.onLoadMoreFuncId = prop as string
|
this.onLoadMoreFuncId = prop as string
|
||||||
break
|
break
|
||||||
|
case "onScroll":
|
||||||
|
this.onScrollFuncId = prop as string
|
||||||
|
break
|
||||||
case "loadMoreView":
|
case "loadMoreView":
|
||||||
this.loadMoreViewId = prop as string
|
this.loadMoreViewId = prop as string
|
||||||
break
|
break
|
||||||
@ -114,7 +118,11 @@ export class DoricListNode extends DoricSuperNode {
|
|||||||
build() {
|
build() {
|
||||||
const ret = document.createElement('div')
|
const ret = document.createElement('div')
|
||||||
ret.style.overflow = "scroll"
|
ret.style.overflow = "scroll"
|
||||||
ret.addEventListener("scroll", () => {
|
ret.addEventListener("scroll", event => {
|
||||||
|
if (this.onScrollFuncId) {
|
||||||
|
this.callJSResponse(this.onScrollFuncId,
|
||||||
|
{ x: (event.target as HTMLElement).scrollLeft || 0, y: (event.target as HTMLElement).scrollTop })
|
||||||
|
}
|
||||||
if (this.loadMore) {
|
if (this.loadMore) {
|
||||||
if (ret.scrollTop + ret.offsetHeight === ret.scrollHeight) {
|
if (ret.scrollTop + ret.offsetHeight === ret.scrollHeight) {
|
||||||
this.onScrollToEnd()
|
this.onScrollToEnd()
|
||||||
|
Reference in New Issue
Block a user