react-keeper icon indicating copy to clipboard operation
react-keeper copied to clipboard

几点疑惑

Open ldwstyle opened this issue 6 years ago • 12 comments

1.react-keeper有没有类似react-router withRouter的组件,让我能够在页面中获取路由信息。 2.react-keeper的Route匹配规则有没有类似react-router

<Switch location={location}></Switch>

的匹配规则,主要解决页面跳转动画问题。举例:用react-transition-group做动画,从首页进入列表页面,首页移除,列表页渲染,但是react-transition-group会把首页保留一段时间(做动画使用),但是Route会强行把首页替换成列表页(由于浏览器地址变了),结果是页面上出现2个列表页,这样我根本无法做动画。 3.leaveFilter。举例说明:

<Route  component={Index} leaveFilter={this.leaveFilter}  path="/" />     
<Route  component={List} leaveFilter={this.leaveFilter} path="/project/:projectId>" />    
<Route  component={Task} leaveFilter={this.leaveFilter} path="/project/:projectId/task/:taskId>" />   

从Index页面进入List页面,会触发每个Route的leaveFilter,我认为应该只触发Index-Route的leaveFilter,因为当前就是Index离开了。

ldwstyle avatar Jun 13 '19 07:06 ldwstyle

您好,请问你的列表页,能缓存住滚动位置吗?

jingjing17890 avatar Jun 17 '19 12:06 jingjing17890

@jingjing17890 您的这个提问跟我说的几个疑惑好像没有什么关系,如果您要是作缓存的话,react-keeper有作缓存的api,是可以缓存住滚动条的位置的,他的缓存原理就是把要缓存的页面加了display:none

ldwstyle avatar Jun 18 '19 03:06 ldwstyle

额,可以缓存住滚动条位置啊?但是如果我从一个路由,再跳回到列表的路由,,我的滚动条位置,没缓存住啊

| | 孙净 邮箱:[email protected] |

签名由 网易邮箱大师 定制

在2019年06月18日 11:58,ldwstyle 写道:

@jingjing17890 您的这个提问跟我说的几个疑惑好像没有什么关系,如果您要是作缓存的话,react-keeper有作缓存的api,是可以缓存住滚动条的位置的,他的缓存原理就是把要缓存的页面加了display:none

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

jingjing17890 avatar Jun 18 '19 04:06 jingjing17890

说明文档我全看了一遍,,没有看到您说的缓存滚动条的api啊,目前我其他信息都缓存住了,但是滚动条,没缓存住

| | 孙净 邮箱:[email protected] |

签名由 网易邮箱大师 定制

在2019年06月18日 12:06,jingjing17890 写道: 额,可以缓存住滚动条位置啊?但是如果我从一个路由,再跳回到列表的路由,,我的滚动条位置,没缓存住啊

| | 孙净 邮箱:[email protected] |

签名由 网易邮箱大师 定制

在2019年06月18日 11:58,ldwstyle 写道:

@jingjing17890 您的这个提问跟我说的几个疑惑好像没有什么关系,如果您要是作缓存的话,react-keeper有作缓存的api,是可以缓存住滚动条的位置的,他的缓存原理就是把要缓存的页面加了display:none

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

jingjing17890 avatar Jun 18 '19 04:06 jingjing17890

可以check下滚动的容器,正常情况滚动条是不需要单独存储的,页面缓存会缓存住滚动条。

——————————————— 张小龙 [email protected]

在 2019年6月18日,下午12:10,jingjing17890 [email protected] 写道:

说明文档我全看了一遍,,没有看到您说的缓存滚动条的api啊,目前我其他信息都缓存住了,但是滚动条,没缓存住

lanistor avatar Jun 18 '19 04:06 lanistor

那或许是因为我布局的问题??我滚动的不是整个页面,是页面内部,导航下方的部分

| | 孙净 邮箱:[email protected] |

签名由 网易邮箱大师 定制

在2019年06月18日 12:11,vifird 写道: 可以check下滚动的容器,正常情况滚动条是不需要单独存储的,页面缓存会缓存住滚动条。

——————————————— 张小龙 [email protected]

在 2019年6月18日,下午12:10,jingjing17890 [email protected] 写道:

说明文档我全看了一遍,,没有看到您说的缓存滚动条的api啊,目前我其他信息都缓存住了,但是滚动条,没缓存住

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

jingjing17890 avatar Jun 18 '19 04:06 jingjing17890

@ldwstyle 可以尝试使用下context.history。

lanistor avatar Jun 18 '19 04:06 lanistor

您的意思是这边只支持整个页面的滚动条缓存,对吗?那如果整个外部容器不动,里面有一个元素,会滚动,这样是缓存不住的对吧?

| | 孙净 邮箱:[email protected] |

签名由 网易邮箱大师 定制

在2019年06月18日 12:11,vifird 写道: 可以check下滚动的容器,正常情况滚动条是不需要单独存储的,页面缓存会缓存住滚动条。

——————————————— 张小龙 [email protected]

在 2019年6月18日,下午12:10,jingjing17890 [email protected] 写道:

说明文档我全看了一遍,,没有看到您说的缓存滚动条的api啊,目前我其他信息都缓存住了,但是滚动条,没缓存住

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

jingjing17890 avatar Jun 18 '19 04:06 jingjing17890

可以加个联系方式聊吗?诚心请教啊

| | 孙净 邮箱:[email protected] |

签名由 网易邮箱大师 定制

在2019年06月18日 12:11,vifird 写道: 可以check下滚动的容器,正常情况滚动条是不需要单独存储的,页面缓存会缓存住滚动条。

——————————————— 张小龙 [email protected]

在 2019年6月18日,下午12:10,jingjing17890 [email protected] 写道:

说明文档我全看了一遍,,没有看到您说的缓存滚动条的api啊,目前我其他信息都缓存住了,但是滚动条,没缓存住

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

jingjing17890 avatar Jun 18 '19 04:06 jingjing17890

@vifird 请问context.history如何使用,谢谢!

ldwstyle avatar Jun 18 '19 05:06 ldwstyle

第一个问题我也遇到了,我参考的是这个如何监听URL的变化 具体实现

function addHistoryEvent (type) {
  var origin = history[type]
  return function() {
    var rv = origin.apply(this, arguments)
    var e = new Event(type)
    e.arguments = arguments
    window.dispatchEvent(e)
    return rv
  }
}

history.pushState = addHistoryEvent('pushState')
history.replaceState = addHistoryEvent('replaceState')

window.addEventListener('replaceState', this.getUrlKeyWrap)
window.addEventListener('pushState', this.getUrlKeyWrap)
window.addEventListener('popstate', this.getUrlKeyWrap)

lvSally avatar Dec 26 '19 06:12 lvSally

@vifird 请问context.history如何使用,谢谢! 作者有解决这个滚动的问题吗,我的也缓存不住滚动条

mamababa avatar Sep 02 '20 05:09 mamababa