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

点击浏览器的前进和后退时TAB页没有正确切换

Open huaxiaosxl opened this issue 6 years ago • 2 comments

我准备使用您的这个框架开发一个管理后台,感谢您的分享,谢谢!

我在测试过程中发现点击浏览器的前进和后退时TAB页没有正确切换,左侧导航菜单是有正确切换样式的,但TAB页没有自动切换到对应的页面,期待能够增加此功能。

huaxiaosxl avatar May 15 '19 09:05 huaxiaosxl

@huaxiaosxl 感谢🙏提出此问题,下期研究研究此功能!

kuhami avatar May 15 '19 09:05 kuhami

第一想到的方法是componentWillReceiveProps,代码如下:

componentWillReceiveProps(nextProps) {
    if (nextProps.history.action === "POP" && this.props.location.pathname !== nextProps.location.pathname) {
      console.log('pop')
      this.onHandlePage({ key: nextProps.location.pathname })
    }
  }

可是我们在点击左侧菜单的时候用的push,导致回退需要点2次才能回到前一个页面😂

Clearives avatar Jul 04 '19 01:07 Clearives