You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.8 KiB
58 lines
1.8 KiB
const Component = React.Component;
|
|
const Router = window.ReactRouterDOM.HashRouter;
|
|
const Route = window.ReactRouterDOM.Route;
|
|
const Link = window.ReactRouterDOM.Link;
|
|
const Prompt = window.ReactRouterDOM.Prompt;
|
|
const Switch = window.ReactRouterDOM.Switch;
|
|
const Redirect = window.ReactRouterDOM.Redirect;
|
|
//const createHashHistory=win
|
|
//antd
|
|
const Button = antd.Button;
|
|
|
|
class Home extends Component {
|
|
render() {
|
|
return (
|
|
<div>
|
|
<h2>
|
|
<Button type="primary">Home</Button>
|
|
</h2>
|
|
</div>
|
|
)
|
|
}
|
|
}
|
|
|
|
const About = () => (
|
|
<div>
|
|
<h2>About</h2>
|
|
</div>
|
|
)
|
|
|
|
const Product = () => (
|
|
<div>
|
|
<h2>Product</h2>
|
|
</div>
|
|
)
|
|
|
|
class App extends Component {
|
|
render() {
|
|
return (
|
|
<Router>
|
|
<div className="App">
|
|
<Link to="/">Home</Link>
|
|
<Link to="/About">About</Link>
|
|
<Link to="/Product">Product</Link>
|
|
<hr />
|
|
<Route path="/" exact component={Home}></Route>
|
|
<Route path="/about" component={About}></Route>
|
|
<Route path="/product" component={Product}></Route>
|
|
</div>
|
|
</Router>
|
|
);
|
|
}
|
|
}
|
|
|
|
ReactDOM.render(
|
|
<App />
|
|
,
|
|
document.getElementById('app')
|
|
); |