frontend/src/App.js

39 lines
1.1 KiB
JavaScript
Raw Normal View History

import ReactDOM from 'react-dom';
import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link } from "react-router-dom";
import "./App.css"
import "./assets/comm.css"
2021-10-29 14:47:23 +08:00
import {Redirect} from "react-router-dom";
import { Avatar, Badge } from 'zent';
2021-10-29 14:47:23 +08:00
import login from './pages/login/login';
import home from './pages/home/home';
export default class App extends Component {
state = {
pathname:'',
};
componentWillMount(){
const pathname=window.location.href.lastIndexOf('\/');
const pathnamestr=window.location.href.substr(pathname);
this.setState({pathname:`${pathnamestr}`});
}
render() {
return (
2021-10-29 14:47:23 +08:00
<Router>
2021-11-02 09:32:55 +08:00
<Route path="/login" exact={true} component={login} />
<Route path="/home" component={home} />
2021-11-08 16:52:56 +08:00
{/* <Route exact={true} path="/home" render={
()=> (
2021-11-08 16:31:48 +08:00
<Redirect to="/home#/system/account-list"/>)}>
2021-11-08 16:52:56 +08:00
</Route> */}
2021-11-02 09:32:55 +08:00
<Route exact={true} path="/" render={
2021-10-29 14:47:23 +08:00
()=> (
<Redirect to="/login"/>)}>
</Route>
</Router>
);
}
2021-10-25 11:49:03 +08:00
}