search

Home  >  Q&A  >  body text

angular.js - React-redux app scroll bar position record?

When developing a single-page application, the scroll bar will always maintain a fixed position when switching pages. Now scroll-behavior is used to solve this problem and can also record the scroll bar position of the previous page, but it If asynchronous is not supported, do you guys have a good solution?

PHPzPHPz2782 days ago766

reply all(1)I'll reply

  • 大家讲道理

    大家讲道理2017-05-15 17:01:11

    For such a requirement, it is indispensable to maintain the scroll bar position as state.
    The remaining method that can be thought of is to use the API provided by react router, onEnter to prefetch the data and set the redux store, and the table will automatically fill the data according to the store. In this way, when the page render is completed, setting the scroll bar position is completely no problem.

    reply
    0
  • Cancelreply