Fixed routing

4.x.x
jayasanka 6 years ago
parent 05d2e3dab5
commit 2a5cc97de9

@ -13,7 +13,8 @@
"antd": "^3.15.0", "antd": "^3.15.0",
"react": "^16.8.4", "react": "^16.8.4",
"react-dom": "^16.8.4", "react-dom": "^16.8.4",
"react-scripts": "2.1.8" "react-scripts": "2.1.8",
"react-router-dom": "latest"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.0.0", "@babel/core": "^7.0.0",

@ -1,17 +1,19 @@
import React from "react"; import React from "react";
import { version, Button } from 'antd';
import "antd/dist/antd.css"; import "antd/dist/antd.css";
import "./index.css"; import "./index.css";
import {BrowserRouter, Route, Switch} from 'react-router-dom';
import Dashboard from "./pages/dashboard"
import Login from "./pages/login"
class App extends React.Component { class App extends React.Component {
render() { render() {
return ( return (
<div className="App"> <BrowserRouter>
<p>Current antd version: {version}</p> <Switch>
<p>Please fork this codesandbox to reproduce your issue.</p> <Route path="/publisher" component={Dashboard} exact/>
<p> fork 这个链接来重现你碰到的问题</p> <Route path="/publisher/login" component={Login}/>
<Button type="primary">Hello</Button> </Switch>
</div> </BrowserRouter>
); );
} }
} }

@ -0,0 +1,19 @@
import React from "react";
import { version, Button } from 'antd';
import {Link} from 'react-router-dom';
class Dashboard extends React.Component {
render() {
return (
<div className="App">
<p>Currentdddddd antd version: {version}</p>
<p>Please fork this codesandbox to reproduce your issue.</p>
<p> fork 这个链接来重现你碰到的问题</p>
<Link to="/login">login</Link>
<Button type="primary">Hello</Button>
</div>
);
}
}
export default Dashboard;

@ -0,0 +1,17 @@
import React from "react";
import { version, Button } from 'antd';
class Login extends React.Component {
render() {
return (
<div className="App">
<p>Current antd version: {version}</p>
<p>Please fork this codesandbox to reproduce your issue.</p>
<p> fork 这个链接来重现你碰到的问题</p>
<Button type="primary">Hello</Button>
</div>
);
}
}
export default Login;
Loading…
Cancel
Save