Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 使用history.goBack恢复路由器4中以前的滚动位置?_Reactjs_React Router_Single Page Application_Html5 History - Fatal编程技术网

Reactjs 使用history.goBack恢复路由器4中以前的滚动位置?

Reactjs 使用history.goBack恢复路由器4中以前的滚动位置?,reactjs,react-router,single-page-application,html5-history,Reactjs,React Router,Single Page Application,Html5 History,在我的SPA中,我有一个列表,指向使用with router的查看器组件路由。当用户导航到查看器时,withRouter将状态和历史推送到查看器。在查看器中,我正在使用 this.props.history.goBack() 在组件中,它可以恢复位置,但不能恢复列表中的滚动位置,并将窗口返回顶部 这是使用goBack()时需要的吗 AFAIK,如上所述使用scrollIntoView将无法使用,因为ref无法分配给功能组件,并且getElementById无法找到分配给组件渲染元素的id 你找

在我的SPA中,我有一个
列表,指向使用
with router
的查看器组件路由。当用户导航到查看器时,withRouter将状态和历史推送到查看器。在查看器中,我正在使用

this.props.history.goBack()
组件中,它可以恢复位置,但不能恢复列表中的滚动位置,并将窗口返回顶部

这是使用
goBack()
时需要的吗


AFAIK,如上所述使用
scrollIntoView
将无法使用,因为
ref
无法分配给功能组件,并且
getElementById
无法找到分配给组件渲染元素的
id

你找到解决这个问题的办法了吗?