TODO: tonight router
This commit is contained in:
parent
065254c672
commit
1b3d440f8d
22
src/App.js
22
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 {
|
|||
<Switch>
|
||||
<Tabs
|
||||
onChange={(e) => {
|
||||
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 {
|
|||
|
||||
|
||||
<TabPane tab="数据表格" key="content_table">
|
||||
<Route path="/data" render={()=>{
|
||||
return <TableData platform={this.state.platform} ></TableData>
|
||||
}} ></Route>
|
||||
<Route path="/count" render={()=>{
|
||||
return <ChartsCount platform={this.state.platform} ></ChartsCount>
|
||||
}} ></Route>
|
||||
<Route path="/data" render={()=>{
|
||||
return <TableData platform={this.state.platform} ></TableData>
|
||||
}} ></Route>
|
||||
</TabPane>
|
||||
|
||||
<TabPane tab="tag统计" key="tag_count">
|
||||
<Route path="/data" render={()=>{
|
||||
return <TableData platform={this.state.platform} ></TableData>
|
||||
}} ></Route>
|
||||
<Route path="/count" render={()=>{
|
||||
return <ChartsCount platform={this.state.platform} ></ChartsCount>
|
||||
}} ></Route>
|
||||
|
|
Loading…
Reference in New Issue
Block a user