Skip to content

列表项一定要有高度吗? #3

@JuctTr

Description

@JuctTr
    function computeTransformedData(oldArr) {
      if ((!props.flxedBlockHeight && props.pageMode && vb.value) || !props.pageMode) {
        let curHeight = props.pageMode ? vb.value.offsetTop : 0
        // 每一次的虚拟列表的第一个的scrolTop
        const rt = [curHeight]
        oldArr.forEach((item) => {
          curHeight += item.height
          // 每一次计算后端的scrollTop
          rt.push(curHeight)
        })
        state.transformedData = rt
      }
    }

你好,有点不太明白,为啥这里的列表项中,一定要有一个高度item.height
实际场景我们传入的列表数组,不一定都有一个高度吧

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions