Skip to content

有bug,过滤数据的时候,显示有数据,没有返回节点 #119

@galan99

Description

@galan99

image

调试如下

filter (h) {
      let delta = this.delta
      const slots = this.$slots.default || []
      console.log(delta)
      // item-mode shoud judge from items prop.
      if (this.item) {
        delta.total = this.itemcount
        if (delta.keeps > delta.total) {
          delta.end = delta.total - 1
        }
      } else {
        if (!slots.length) {
          delta.start = 0
        }
        delta.total = slots.length
      }

      let paddingTop, paddingBottom, allHeight
      const hasPadding = delta.total > delta.keeps

      if (this.variable) {
        allHeight = this.getVarAllHeight()
        paddingTop = hasPadding ? this.getVarPaddingTop() : 0
        paddingBottom = hasPadding ? this.getVarPaddingBottom() : 0
      } else {
        allHeight = this.size * delta.total
        paddingTop = this.size * (hasPadding ? delta.start : 0)
        paddingBottom = this.size * (hasPadding ? delta.total - delta.keeps : 0) - paddingTop
      }

      if (paddingBottom < this.size) {
        paddingBottom = 0
      }

      delta.paddingTop = paddingTop
      delta.paddingBottom = paddingBottom
      delta.offsetAll = allHeight - this.size * this.remain

      let renders = []
      console.log(delta.start, delta.total, delta.end) // 此处打印数据
      for (let i = delta.start; i < delta.total && i <= Math.ceil(delta.end); i++) {
        let slot = null
        if (this.item) {
          slot = h(this.item, this.itemprops(i))
        } else {
          slot = slots[i]
        }
        renders.push(slot)
      }
      console.log(renders)
      return renders
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions