m-list-view icon indicating copy to clipboard operation
m-list-view copied to clipboard

希望可以滚动到列表底部

Open hsuehic opened this issue 6 years ago • 1 comments

我在做一个IM 聊天界面的时候,希望初始化和有消息更新的时候,列表的滚动条都可以滚动到底部。

scrollToCurrent() {
    const self = this
    setTimeout(() => {
      if (self.listView) {
        const { listviewRef } = self.listView
        if (listviewRef) {
          const scrollProperties = listviewRef.ListViewRef.getMetrics()
          if (scrollProperties) {
            const { contentLength, visibleLength } = scrollProperties
            if (contentLength && visibleLength) {
              const offset = contentLength - visibleLength
              if (offset > 0) {
                listviewRef.scrollTo(0, offset)
              }
            }
          }
        }
      }
    })
  }

使用以上的代码,拿到的 contentLength不是正确。

hsuehic avatar Jul 04 '18 12:07 hsuehic

能否新增加个属性,让列表从后面的行开始渲染, 然后滚动到底部,下拉时渲染前面的记录?

hsuehic avatar Jul 04 '18 12:07 hsuehic