From 1b3d440f8d1c2fad98032ed7492206b5215a0ad3 Mon Sep 17 00:00:00 2001 From: eson Date: Mon, 31 Aug 2020 18:45:42 +0800 Subject: [PATCH] TODO: tonight router --- src/App.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/App.js b/src/App.js index b11d62b..af53e93 100644 --- a/src/App.js +++ b/src/App.js @@ -11,7 +11,7 @@ import './App.less'; import ChartsCount from './ChartsCount'; import TableData from './TableData'; import TabsRoute from './Router'; -import { Link, Route, Router, HashRouter, Switch } from 'react-router-dom'; +import { Link, Route, Router, HashRouter, Switch, useHistory } from 'react-router-dom'; const { TabPane } = Tabs; const { Header, Content, Footer, Sider } = Layout; @@ -82,18 +82,22 @@ class App extends React.Component { { + const history = useHistory(); + const { platform } = this.state; this.setState({ key: e }) switch (e) { case "content_table": - this.props.history.push("#/data") + history.push("#/data") + // this.props.history.push("#/data") if (this.refs.ctable) { this.refs.ctable.changePlatform(platform); } break; case "tag_count": - this.props.history.push("#/count") + history.push("#/count") + // this.props.history.push("#/count") if (this.refs.tcharts) { this.refs.tcharts.changePlatform(platform); } @@ -110,18 +114,12 @@ class App extends React.Component { - { - return - }} > - { - return - }} > + { + return + }} > - { - return - }} > { return }} >