Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在非doument.body和document.documentElement的屏幕滚动问题 #81

Closed
HelloAny opened this issue Nov 20, 2020 · 5 comments
Closed

Comments

@HelloAny
Copy link

当我的共享滚动容器不在BodyHtml上使用插件的时候,会出现滚动高度无法保存的问题,虽然这个应该是react-router-dom的问题,但是希望能有解决方案

问题样例:
https://codesandbox.io/s/nifty-jepsen-4hs1k

一些思路:
keepAlive上可以添加新的props,比如提供一个监听classid的接口来监听当前容器的滚动高度,然后保存不同界面的高度<KeepAlive onListen="#App">

@CJY0208
Copy link
Owner

CJY0208 commented Nov 21, 2020

直接借用 saveScrollPosition prop 的位置如何?

三种取值

  1. "screen": 监听屏幕共用容器
  2. true | false: 监听 KeepAlive 内部
  3. selector name: 监听指定 dom 节点
<KeepAlive saveScrollPosition="screen">
<KeepAlive saveScrollPosition>
<KeepAlive saveScrollPosition=".my-view .my-scroll-view">

相较于目前,新增了第 3 项

@HelloAny
Copy link
Author

直接借用 saveScrollPosition prop 的位置如何?

三种取值

  1. "screen": 监听屏幕共用容器
  2. true | false: 监听 KeepAlive 内部
  3. selector name: 监听指定 dom 节点
<KeepAlive saveScrollPosition="screen">
<KeepAlive saveScrollPosition>
<KeepAlive saveScrollPosition=".my-view .my-scroll-view">

相较于目前,新增了第 3 项

嗯,可以

@CJY0208
Copy link
Owner

CJY0208 commented Nov 23, 2020

OK 了,v0.6.1,试试~

@HelloAny
Copy link
Author

@CJY0208 谢谢大佬,OK了

@CJY0208
Copy link
Owner

CJY0208 commented Nov 24, 2020

OK,那这个关了哦

@CJY0208 CJY0208 closed this as completed Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants