GithubHelp home page GithubHelp logo

Comments (6)

tingyuxuan2302 avatar tingyuxuan2302 commented on July 16, 2024 4

进入列表需要定位到某元素位置,是否有API支持index值滚动定位?

暂不支持,非常好的建议,最近有点忙,后期找时间会加入该需求🤝

from taro3-virtual-list.

GrapevineLin avatar GrapevineLin commented on July 16, 2024

同求,支持

from taro3-virtual-list.

mdddj avatar mdddj commented on July 16, 2024

+1

from taro3-virtual-list.

wiscgazf avatar wiscgazf commented on July 16, 2024

+1 哈哈~

我还试了通过scrollIntoView 属性 定位到指定的item,但是发现超过10 就会被分割成一个page,然而设置的item组件容器的id 在scroll-view组件中必须是根容器才能识别 外层包裹page后 没法跟踪 估计没法通过scrollInto的方式定位 得换一种方式定位当前page是第几个 加上前面的page页高度 在设置scrollTop的value了

from taro3-virtual-list.

17 avatar 17 commented on July 16, 2024

入侵比较少,方法比较脏,需要约定,但是最终能勉强实现效果。

    this.props.refs.current = {
      scrollTo: (i) => {
        this.setState({
          scrollTop: i == 0 ? i + Math.random() : i
        })
      },
      scrollToIndex: (index) => {
        const { segmentNum } = this.props
        const pageIndex = 0 ^ index / segmentNum
        this.setState({
          scrollIntoView: `wrap_${pageIndex}`
        })
        setTimeout(() => {
          this.setState({
            scrollIntoView: `item_${index}`
          })
        }, 10)
      }
    }

比较好的方法就是 查询高度的时候顺便查询子元素高度制作成 Map 。

from taro3-virtual-list.

syx112233 avatar syx112233 commented on July 16, 2024

同求

from taro3-virtual-list.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.