Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lin-xi/react-xrouter
react router
https://github.com/lin-xi/react-xrouter
Last synced: 15 days ago
JSON representation
react router
- Host: GitHub
- URL: https://github.com/lin-xi/react-xrouter
- Owner: lin-xi
- Created: 2016-02-22T12:01:45.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-02-22T12:52:34.000Z (almost 9 years ago)
- Last Synced: 2024-11-11T09:44:33.677Z (2 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
React-XRouter
====>React-XRouter 是一个类似ReactRouter的类库。
--------
##依赖
无
--------
##安装:
>npm install react-xrouter --save
--------
## 使用```
var Router = require('react-xrouter');
Router.route({
'/': {
enter: function () {
require.ensure([], function(require){
//可以做些统计写日志的工作
var HomePage = require('./pages/home/HomePage.js');
ReactDOM.render(, document.querySelector('#pinzhi'));
});
}
},
'/detail/:id': {
enter: function (param) {
require.ensure([], function(require){
var DetailPage = require('./pages/detail/DetailPage.js');
ReactDOM.render(, document.querySelector('#pinzhi'));
});
},
leave: function(){
}
},
'default': {
redirect: '/'
}
});```
--------
## API```
var Router = require('react-xrouter');
Router.back();
Router.redirect(path);
```