AbnerMing888 / HarmonyOsRefresh

HarmonyOsRefresh是一个鸿蒙版的刷新组件,超简单使用,支持下拉刷新和上拉加载,支持各种组件,List、Grid、Column、Row……
Apache License 2.0
172 stars 23 forks source link

向listview插入数据后,下拉刷新失效 #169

Open a415715165 opened 1 month ago

a415715165 commented 1 month ago

import { ActionBar } from '../ActionBar' import { ListView, RefreshController, RefreshDataSource } from '@abner/refresh'

/**

@Entry @Component struct ListViewUpAndDownLazyPage { controller: RefreshController = new RefreshController() //刷新控制器 lazyDataSource: RefreshDataSource = new RefreshDataSource() //懒加载数据

aboutToAppear() { this.lazyDataSource.initData(this.getArray()) }

private getArray(): Array { let array: Array = [] for (let i = 0; i < 3; i++) { array.push(i) } return array }

async getData() { setTimeout(() => { let array: number[] = [];

  for (let index = 0; index < 3; index++) {
    array.push(index);
  }
  this.lazyDataSource.pushDataArray(array)

}, 500)

}

/**

BoxJ commented 1 month ago

的确是这样,下拉刷新一次后,之后往上滑动一下,再次下拉才能拉下来,无法直接2次下拉刷新

AbnerMing888 commented 1 month ago

确定吗,我怎么才能复现呢

BoxJ commented 1 month ago

listAttribute:(attr)=>{ attr.height = WindowHeight },

这个设置去掉就正常了

a415715165 commented 1 month ago

这个设置怎么去掉,源码里去掉?

BoxJ commented 1 month ago

这个设置怎么去掉,源码里去掉?

ListView({ lazyDataSource: this.dataSource, itemLayout: (item, index) => this.itemLayout(item, index), //条目布局 controller: this.controller, //控制器,负责关闭下拉和上拉 onRefresh: () => { this.loadDataSource() }, // onLoadMore:()=>{ // this.controller.finishLoadMore(true) // }, // listAttribute:(attr)=>{ // attr.height = WindowHeight - Number(AppStorage.get('statusBarHeightVp')) - 44 // }, lazyCachedCount:3 }) .layoutWeight(1)

使用中去掉了,设置后就不行