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.
 
 

1.3 KiB

路由

  • order: 2

react-router@0.13.x 进行结合使用。


var Router = antd.Router;
var Route = Router.Route;
var Link = Router.Link;
var RouteHandler = Router.RouteHandler;
var Breadcrumb = antd.Breadcrumb;

var Apps = React.createClass({
  render() {
    return <ul className="app-list">
      <li><Link to="/apps/1">应用1</Link></li>
      <li><Link to="/apps/2">应用2</Link></li>
    </ul>;
  }
});

var App = React.createClass({
  render() {
    return <div></div>;
  }
});

var App = React.createClass({
  render() {
    return (<div>
      <div className="demo-nav">
        <Link to="/">首页</Link>
        <Link to="/apps">应用列表</Link>
      </div>
      <Breadcrumb />
      <RouteHandler />
    </div>);
  }
});

var routes = (
  <Route name="首页" path="/" handler={App} ignoreScrollBehavior>
    <Route name="应用列表" path="/apps" handler={Apps}>
      <Route name="应用:id" path="/apps/:id" handler={App} />
    </Route>
  </Route>
);

Router.run(routes, Router.HashLocation, (Root) => {
  React.render(<Root />, document.getElementById('components-breadcrumb-demo-router'));
});