mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-08 01:53:34 +08:00
🔧 remove react-router from devDeps (#21276)
This commit is contained in:
parent
e36079c557
commit
04bc6d5b28
@ -9,11 +9,11 @@ title:
|
||||
|
||||
## zh-CN
|
||||
|
||||
和 `react-router@4`,或其他路由进行结合使用。
|
||||
和 `react-router@4+`,或其他路由进行结合使用。
|
||||
|
||||
## en-US
|
||||
|
||||
Used together with `react-router@4` or other router.
|
||||
Used together with `react-router@4+` or other router.
|
||||
|
||||
```jsx
|
||||
import { HashRouter as Router, Route, Switch, Link, withRouter } from 'react-router-dom';
|
||||
|
@ -1,82 +0,0 @@
|
||||
---
|
||||
order: 2
|
||||
iframe: 200
|
||||
reactRouter: react-router
|
||||
title:
|
||||
zh-CN: react-router
|
||||
en-US: React Router Integration
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
||||
和 `react-router@2` `react-router@3` 进行结合使用。
|
||||
|
||||
## en-US
|
||||
|
||||
Used together with `react-router@2` `react-router@3`.
|
||||
|
||||
```jsx
|
||||
import { Router, Route, Link, hashHistory } from 'react-router';
|
||||
import { Breadcrumb, Alert } from 'antd';
|
||||
|
||||
const Apps = () => (
|
||||
<ul className="app-list">
|
||||
<li>
|
||||
<Link to="/apps/1">Application1</Link>:<Link to="/apps/1/detail">Detail</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link to="/apps/2">Application2</Link>:<Link to="/apps/2/detail">Detail</Link>
|
||||
</li>
|
||||
</ul>
|
||||
);
|
||||
|
||||
const Home = ({ routes, params, children }) => (
|
||||
<div className="demo">
|
||||
<div className="demo-nav">
|
||||
<Link to="/">Home</Link>
|
||||
<Link to="/apps">Application List</Link>
|
||||
</div>
|
||||
{children || 'Home Page'}
|
||||
<Alert style={{ margin: '16px 0' }} message="Click the navigation above to switch:" />
|
||||
<Breadcrumb routes={routes} params={params} />
|
||||
</div>
|
||||
);
|
||||
|
||||
ReactDOM.render(
|
||||
<Router history={hashHistory}>
|
||||
<Route name="home" breadcrumbName="Home" path="/" component={Home}>
|
||||
<Route name="apps" breadcrumbName="Application List" path="apps" component={Apps}>
|
||||
<Route name="app" breadcrumbName="Application:id" path=":id">
|
||||
<Route name="detail" breadcrumbName="Detail" path="detail" />
|
||||
</Route>
|
||||
</Route>
|
||||
</Route>
|
||||
</Router>,
|
||||
mountNode,
|
||||
);
|
||||
```
|
||||
|
||||
```css
|
||||
.demo {
|
||||
margin: 16px;
|
||||
}
|
||||
.demo-nav {
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
margin-bottom: 16px;
|
||||
background: #f8f8f8;
|
||||
}
|
||||
.demo-nav a {
|
||||
line-height: 30px;
|
||||
padding: 0 8px;
|
||||
}
|
||||
.app-list {
|
||||
margin-top: 16px;
|
||||
}
|
||||
```
|
||||
|
||||
<style>
|
||||
[data-theme="dark"] .demo-nav {
|
||||
background: #141414;
|
||||
}
|
||||
</style>
|
@ -228,7 +228,6 @@
|
||||
"react-infinite-scroller": "^1.2.4",
|
||||
"react-intl": "^3.1.1",
|
||||
"react-resizable": "^1.8.0",
|
||||
"react-router": "^3.2.3",
|
||||
"react-router-dom": "^5.0.1",
|
||||
"react-sticky": "^6.0.3",
|
||||
"react-test-renderer": "^16.8.6",
|
||||
|
Loading…
Reference in New Issue
Block a user