Code Monkey home page Code Monkey logo

Comments (9)

huanzheke avatar huanzheke commented on September 27, 2024

版本为1.3.1, 项目是h5页面.

from react-router-cache-route.

CJY0208 avatar CJY0208 commented on September 27, 2024

能否尝试检查除了滚动距离外,其他的列表数据是否被缓存了?

例如已经请求的列表数据、或者检查列表页组件生命周期是否从头开始了

需要先排除 列表页与详情页共用了 body 作为滚动容器导致滚动位置被重置 的问题

from react-router-cache-route.

huanzheke avatar huanzheke commented on September 27, 2024

能否尝试检查除了滚动距离外,其他的列表数据是否被缓存了?

例如已经请求的列表数据,或者检查列表页组件生命周期是否从头开始了

先需要排除列表页与详情页共用了 body 作为滚动容器导致滚动位置被重置的问题

列表页确实跟详情页共用了body滚动容器,但是没办法的事情呀,我们的列表要求吸顶还有置顶按钮,用window来操作

from react-router-cache-route.

huanzheke avatar huanzheke commented on September 27, 2024

仔细观察到,商品详情第一次返回到列表的话是可以cache滚动条的,之后又不行了,这是啥子原因,ios很烦

from react-router-cache-route.

CJY0208 avatar CJY0208 commented on September 27, 2024

你们的需求应该也可以通过自建滚动容器来实现

目前来说 CacheRoute 无法处理共用滚动容器的情况,目前在和 react-keep-alive 作者讨论 saveScrollTop 函数功能,如果得以支持可以考虑一下这个方案

后续 CacheRoute 也会尝试支持此方案,不过时间待定,目前比较忙

saveScrollTop 行为的运作方式大致为:

在组件被缓存时将所有订阅了 saveScrollTop 需求的滚动容器 scrollTop 记住,并于组件恢复时恢复各订阅容器的 scrollTop,这个功能理论上将可作用于共用滚动容器的情况

from react-router-cache-route.

huanzheke avatar huanzheke commented on September 27, 2024

CacheRoute

你们的需求应该也可以通过自建滚动容器来实现

来说目前CacheRoute无法处理共用滚动容器的情况,目前在和反应,保活作者讨论saveScrollTop函数功能,如果得以支持可以考虑一下这个方案

后续CacheRoute也会尝试请立即获取iTunes此方案,不过时间待定,目前比较忙

saveScrollTop 行为的运作方式大致为:

在组件被缓存时将所有订阅了saveScrollTop需求的滚动容器scrollTop记住,并于组件恢复时恢复各订阅容器的scrollTop,这个功能理论上将可作用于共用滚动容器的情况

现在已经解决了,用div滚动,但问题是每个页面都这样的话导致很重复

from react-router-cache-route.

ShenChang618 avatar ShenChang618 commented on September 27, 2024

@huanzheke 可以尝试在离开列表页时,保存滚动值;返回到列表页时触发生命周期,然后在激活这个生命周期中重新设置滚动值。

from react-router-cache-route.

huanzheke avatar huanzheke commented on September 27, 2024

@huanzheke 可以尝试在离开列表页时,保存滚动值;返回到列表页时触发生命周期,然后在激活这个生命周期中重新设置滚动值。

谢谢大佬,不怎么好单独维护,还是用一个容器让他自生自灭吧.

from react-router-cache-route.

CJY0208 avatar CJY0208 commented on September 27, 2024

@huanzheke

新发布 v1.8.0 尝试解决共用容器问题,为 CacheRoute 增加 saveScrollPosition 属性可实现此功能

from react-router-cache-route.

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.