bookmark/front/src/App.jsx

37 lines
1.0 KiB
React
Raw Normal View History

2019-06-26 17:41:01 +08:00
import React, { Component } from "react";
2019-06-27 11:32:03 +08:00
import { Route, Switch, Redirect } from "react-router-dom";
2019-06-26 17:41:01 +08:00
import { withRouter } from "react-router-dom";
import { Provider } from "react-redux";
import store from "./redux";
import Login from "./pages/public/Login";
2019-06-27 11:32:03 +08:00
import Main from "./pages/Main";
import NotFound from "./pages/public/notFound/NotFound";
2019-06-26 17:41:01 +08:00
class App extends Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
const mainStyle = {
fontSize: "0.16rem"
};
return (
<Provider store={store}>
<div className="fullScreen" style={mainStyle}>
2019-06-27 11:32:03 +08:00
<Switch>
<Route exact path="/" component={Main} />
<Route exact path="/public/login" component={Login} />
<Route exact path="/404" component={NotFound} />
{/* 当前面的路由都匹配不到时就会重定向到/404 */}
<Redirect path="/" to="/404" />
</Switch>
2019-06-26 17:41:01 +08:00
</div>
</Provider>
);
}
}
export default withRouter(App);