├── src ├── index.js ├── utils.js ├── router-wrapper.js ├── router-view.js └── router.js ├── docs ├── favicon.ico ├── static │ ├── js │ │ ├── 0.d20f7d51.chunk.js │ │ └── 0.d20f7d51.chunk.js.map │ └── css │ │ ├── main.5c32c3f2.css │ │ └── main.5c32c3f2.css.map ├── asset-manifest.json ├── manifest.json ├── index.html └── service-worker.js ├── index.js ├── public ├── favicon.ico ├── manifest.json └── index.html ├── docs-src ├── views │ ├── admin │ │ ├── page3.jsx │ │ ├── Dashboard.jsx │ │ ├── page1.jsx │ │ └── page2.jsx │ ├── About.jsx │ ├── User.jsx │ ├── UserInfo.jsx │ ├── Home.jsx │ └── Error.jsx ├── demo.jsx ├── index.js ├── assets │ ├── anim.css │ ├── common.css │ └── anim.less ├── components │ ├── navbar.jsx │ └── admin-view.jsx ├── App.jsx ├── router.js └── registerServiceWorker.js ├── config ├── jest │ ├── fileTransform.js │ └── cssTransform.js ├── polyfills.js ├── index.js ├── paths.js ├── env.js ├── webpackDevServer.config.js ├── webpack.config.dev.js ├── webpack.config.pack.js └── webpack.config.docs.js ├── .gitignore ├── scripts ├── test.js ├── start.js ├── docs.js └── pack.js ├── LICENSE ├── package.json ├── README.md └── dist ├── index.js └── index.js.map /src/index.js: -------------------------------------------------------------------------------- 1 | import Router from './router' 2 | 3 | export default Router 4 | -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mengdu/react-concise-router/HEAD/docs/favicon.ico -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import Router from './dist' 2 | 3 | export { 4 | Router as default, 5 | Router 6 | } 7 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mengdu/react-concise-router/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /docs-src/views/admin/page3.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | export default function Page3 () { 4 | return
Admin Page3
5 | } 6 | -------------------------------------------------------------------------------- /docs-src/demo.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | export default class Demo extends React.Component { 4 | render () { 5 | return ( 6 |
this is a demo.
7 | ) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /docs/static/js/0.d20f7d51.chunk.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],{228:function(e,n,t){"use strict";function u(){return r.a.createElement("div",null,"Admin Page3")}Object.defineProperty(n,"__esModule",{value:!0}),n.default=u;var a=t(0),r=t.n(a)}}); 2 | //# sourceMappingURL=0.d20f7d51.chunk.js.map -------------------------------------------------------------------------------- /docs-src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom' 3 | import './assets/common.css' 4 | import App from './App' 5 | import registerServiceWorker from './registerServiceWorker' 6 | 7 | ReactDOM.render(, document.getElementById('root')) 8 | registerServiceWorker() 9 | -------------------------------------------------------------------------------- /docs-src/views/About.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Navbar from '../components/navbar' 3 | 4 | export default class About extends React.Component { 5 | render () { 6 | return ( 7 |
8 | 9 |

About Page

10 |
11 | ) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /docs-src/views/User.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Navbar from '../components/navbar' 3 | 4 | 5 | export default class User extends React.Component { 6 | render () { 7 | return ( 8 |
9 | 10 |

User Page

11 |
12 | ) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /docs-src/views/admin/Dashboard.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | export default class Dashboard extends React.Component { 4 | componentWillMount () { 5 | console.log('Dashboard', this) 6 | } 7 | 8 | render () { 9 | return ( 10 |
11 | Dashboard 12 |
13 | ) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /docs-src/views/UserInfo.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Navbar from '../components/navbar' 3 | 4 | export default class UserInfo extends React.Component { 5 | render () { 6 | console.log(this.props) 7 | return ( 8 |
9 | 10 |

UserInfo Page

11 |
12 | ) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /docs/asset-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "main.css": "static/css/main.5c32c3f2.css", 3 | "main.css.map": "static/css/main.5c32c3f2.css.map", 4 | "main.js": "static/js/main.70aeb1bf.js", 5 | "main.js.map": "static/js/main.70aeb1bf.js.map", 6 | "static/js/0.d20f7d51.chunk.js": "static/js/0.d20f7d51.chunk.js", 7 | "static/js/0.d20f7d51.chunk.js.map": "static/js/0.d20f7d51.chunk.js.map" 8 | } -------------------------------------------------------------------------------- /config/jest/fileTransform.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const path = require('path'); 4 | 5 | // This is a custom Jest transformer turning file imports into filenames. 6 | // http://facebook.github.io/jest/docs/en/webpack.html 7 | 8 | module.exports = { 9 | process(src, filename) { 10 | return `module.exports = ${JSON.stringify(path.basename(filename))};`; 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /docs-src/views/Home.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Navbar from '../components/navbar' 3 | 4 | export default class Home extends React.Component { 5 | componentWillMount () { 6 | console.log(this.props) 7 | } 8 | 9 | render () { 10 | return ( 11 |
12 | 13 |

Home Page

14 |
15 | ) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | -------------------------------------------------------------------------------- /config/jest/cssTransform.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // This is a custom Jest transformer turning style imports into empty objects. 4 | // http://facebook.github.io/jest/docs/en/webpack.html 5 | 6 | module.exports = { 7 | process() { 8 | return 'module.exports = {};'; 9 | }, 10 | getCacheKey() { 11 | // The output is always the same. 12 | return 'cssTransform'; 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /docs/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": "./index.html", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": "./index.html", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /docs-src/assets/anim.css: -------------------------------------------------------------------------------- 1 | .fade-in-enter { 2 | opacity: 0; 3 | transform: translateY(100px); 4 | } 5 | .fade-in-enter-active { 6 | opacity: 1; 7 | transform: translateY(0); 8 | transition: all ease-in-out 0.3s; 9 | } 10 | .fade-in-exit { 11 | opacity: 1; 12 | } 13 | .fade-in-exit-active { 14 | opacity: 0; 15 | transform: translateY(100px); 16 | transition: all ease-in-out 0.3s; 17 | } 18 | -------------------------------------------------------------------------------- /docs-src/assets/common.css: -------------------------------------------------------------------------------- 1 | a { 2 | margin: 0 5px; 3 | } 4 | .demo-block { 5 | width: 600px; 6 | min-height: 300px; 7 | border: solid 1px #1FADF2; 8 | padding: 15px; 9 | margin: 0 auto; 10 | } 11 | .link-active { 12 | font-weight: bold; 13 | color: #E04843; 14 | } 15 | 16 | .anim-list .anim-item { 17 | margin-bottom: 10px; 18 | background: #ddd; 19 | padding: 10px; 20 | } 21 | 22 | @import url('./anim.css'); -------------------------------------------------------------------------------- /docs-src/views/Error.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { Link } from 'react-router-dom' 3 | 4 | export default class Home extends React.Component { 5 | render () { 6 | return ( 7 |
8 |

404 Page Not Found !

9 |

10 | Home 11 | User 12 | 404 13 |

14 |
15 | ) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | A concise router base on react-router.
-------------------------------------------------------------------------------- /docs-src/views/admin/page1.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import QueueAnim from 'rc-queue-anim' 3 | 4 | export default function Page1 () { 5 | return ( 6 |
7 |
Admin Page1
8 |
9 | 10 |
item1
11 |
item1
12 |
item1
13 |
item1
14 |
15 |
16 |
17 | ) 18 | } 19 | -------------------------------------------------------------------------------- /docs-src/components/navbar.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { NavLink } from 'react-router-dom' 3 | 4 | export default function Navbar () { 5 | return ( 6 |
7 | Home 8 | User 9 | UserInfo 10 | About 11 | Admin 12 | 404 13 |
14 | ) 15 | } 16 | -------------------------------------------------------------------------------- /docs-src/assets/anim.less: -------------------------------------------------------------------------------- 1 | // .fade-in-enter { 2 | // opacity: 0; 3 | // transform: scale(0.9); 4 | // } 5 | // .fade-in-enter-active { 6 | // opacity: 1; 7 | // transform: translateX(0); 8 | // transition: opacity 300ms, transform 300ms; 9 | // } 10 | // .fade-in-exit { 11 | // opacity: 1; 12 | // } 13 | // .fade-in-exit-active { 14 | // opacity: 0; 15 | // transform: scale(0.9); 16 | // transition: opacity 300ms, transform 300ms; 17 | // } 18 | 19 | .fade-in-enter { 20 | opacity: 0; 21 | transform: translateY(100px); 22 | } 23 | .fade-in-enter-active { 24 | opacity: 1; 25 | transform: translateY(0); 26 | transition: all ease-in-out 0.3s; 27 | } 28 | .fade-in-exit { 29 | opacity: 1; 30 | } 31 | .fade-in-exit-active { 32 | opacity: 0; 33 | transform: translateY(100px); 34 | transition: all ease-in-out 0.3s; 35 | } 36 | -------------------------------------------------------------------------------- /scripts/test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // Do this as the first thing so that any code reading it knows the right env. 4 | process.env.BABEL_ENV = 'test'; 5 | process.env.NODE_ENV = 'test'; 6 | process.env.PUBLIC_URL = ''; 7 | 8 | // Makes the script crash on unhandled rejections instead of silently 9 | // ignoring them. In the future, promise rejections that are not handled will 10 | // terminate the Node.js process with a non-zero exit code. 11 | process.on('unhandledRejection', err => { 12 | throw err; 13 | }); 14 | 15 | // Ensure environment variables are read. 16 | require('../config/env'); 17 | 18 | const jest = require('jest'); 19 | let argv = process.argv.slice(2); 20 | 21 | // Watch unless on CI or in coverage mode 22 | if (!process.env.CI && argv.indexOf('--coverage') < 0) { 23 | argv.push('--watch'); 24 | } 25 | 26 | 27 | jest.run(argv); 28 | -------------------------------------------------------------------------------- /src/utils.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @param {string} path 路径 3 | * @return {string} 返回连接路径 4 | **/ 5 | export function resolve () { 6 | let paths = [] 7 | for (let i in arguments) { 8 | paths.push(arguments[i].replace(/^\s*|\s*$/g, '').replace(/^\//, '')) 9 | } 10 | return paths.join('/') 11 | } 12 | 13 | /** 14 | * 编译字符串 :var 15 | * @param {string} tpl 16 | * @return {function} 返回函数 17 | **/ 18 | export function compileString (tpl) { 19 | let expression = tpl.replace(/('|"|\\)/g, '\\$1') 20 | .replace(/:(\w+)/g, function (txt, key) { 21 | return '\' + data[\'' + key + '\'] + \'' 22 | }) 23 | /*eslint no-new-func: "off"*/ 24 | return new Function('data', 'return (\'' + expression + '\')') 25 | } 26 | 27 | export function objectToQueryString (obj) { 28 | let qs = [] 29 | for (let key in obj) { 30 | qs.push(`${key}=${encodeURIComponent(obj[key])}`) 31 | } 32 | 33 | return qs.join('&') 34 | } 35 | -------------------------------------------------------------------------------- /config/polyfills.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | if (typeof Promise === 'undefined') { 4 | // Rejection tracking prevents a common issue where React gets into an 5 | // inconsistent state due to an error, but it gets swallowed by a Promise, 6 | // and the user has no idea what causes React's erratic future behavior. 7 | require('promise/lib/rejection-tracking').enable(); 8 | window.Promise = require('promise/lib/es6-extensions.js'); 9 | } 10 | 11 | // fetch() polyfill for making API calls. 12 | require('whatwg-fetch'); 13 | 14 | // Object.assign() is commonly used with React. 15 | // It will use the native implementation if it's present and isn't buggy. 16 | Object.assign = require('object-assign'); 17 | 18 | // In tests, polyfill requestAnimationFrame since jsdom doesn't provide it yet. 19 | // We don't polyfill it in the browser--this is user's responsibility. 20 | if (process.env.NODE_ENV === 'test') { 21 | require('raf').polyfill(global); 22 | } 23 | -------------------------------------------------------------------------------- /docs-src/components/admin-view.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { NavLink } from 'react-router-dom' 3 | import router from '../router' 4 | 5 | export default class View extends React.Component { 6 | render () { 7 | return ( 8 |
9 | Admin Page. 10 |
11 | Home 12 | Dashboard 13 | page1 14 | page2 15 | page3 16 | 404 17 |
18 |
{router.view('admin-view')}
19 |
20 | ) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /docs-src/App.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | // import { BrowserRouter as Router, NavLink } from 'react-router-dom' 3 | import router from './router' 4 | 5 | window.router = router 6 | 7 | export default class App extends React.Component { 8 | render () { 9 | // console.log(process.env) 10 | return ( 11 |
12 |

wellcome !

13 | {/*

14 | 15 | 16 |

*/} 17 | 18 |
19 | {router.view()} 20 |
21 |
22 | ) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/router-wrapper.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | /** 4 | * 用于包裹页面,实现切换事件 5 | **/ 6 | export default class RouterWrapper extends React.Component { 7 | state = { 8 | waiting: true 9 | } 10 | 11 | done () { 12 | return (to) => { 13 | if (to) { 14 | const path = typeof to === 'string' ? to : this.props.router.route(to) 15 | this.props.history.push(path) 16 | } else { 17 | this.setState({ 18 | waiting: false 19 | }) 20 | } 21 | } 22 | } 23 | 24 | componentWillMount () { 25 | if (this.props.router.beforeEach) { 26 | if (typeof this.props.router.beforeEach !== 'function') { 27 | throw new Error('The `router.beforeEach` must be a function.') 28 | } 29 | 30 | this.props.router.beforeEach(this.props, this.done()) 31 | } else { 32 | this.setState({ 33 | waiting: false 34 | }) 35 | } 36 | } 37 | render () { 38 | if (this.state.waiting) return null 39 | 40 | // 这里要传递Route组件的props 41 | return 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const fs = require('fs') 3 | require('dotenv').config() 4 | 5 | const appDirectory = fs.realpathSync(process.cwd()) 6 | const resolve = relativePath => path.resolve(appDirectory, relativePath) 7 | 8 | module.exports = { 9 | base: { 10 | appNodeModules: resolve('node_modules'), 11 | yarnLockFile: resolve('yarn.lock'), 12 | appPackageJson: resolve('package.json') 13 | }, 14 | dev: { 15 | appHtml: resolve('public/index.html'), 16 | entryPath: resolve('docs-src'), 17 | entry: resolve('docs-src/index.js'), 18 | appPublic: resolve('public'), 19 | autoOpenBrowser: false, 20 | outputPath: resolve('docs'), 21 | assetsPublicPath: './', 22 | sourceMap: true 23 | }, 24 | pack: { 25 | entryPath: resolve('src'), 26 | entry: resolve('src/index.js'), 27 | outputPath: resolve('dist'), 28 | filename: 'index.js', 29 | // library: 'jQuery', 30 | libraryTarget: 'umd', 31 | // 暴露指定模块,空表示暴露 module.exports 32 | libraryExport: '', 33 | umdNamedDefine: true, 34 | sourceMap: true 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 蓝月萧枫 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/router-view.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { BrowserRouter, HashRouter, Switch, Route } from 'react-router-dom' 3 | 4 | function Fade (props) { 5 | return { 6 | const wrapper = props.wrapper 7 | // location for react-transition-group 8 | return typeof wrapper === 'function' ? wrapper(props.children, location) : props.children 9 | }} /> 10 | } 11 | 12 | export default function RouterView (props) { 13 | const router = props.router 14 | const name = props.name || 'default' 15 | 16 | if (!router.views[name]) throw new Error('The view name `' + name + '` is not defined.') 17 | 18 | const wrapper = router.wrappers[name] 19 | 20 | if (name === 'default') { 21 | if (router.mode === 'hash') { 22 | return ( 23 | 24 | {router.views[name]} 25 | 26 | ) 27 | } else { 28 | return ( 29 | 30 | {router.views[name]} 31 | 32 | ) 33 | } 34 | } 35 | 36 | return {router.views[name]} 37 | } 38 | -------------------------------------------------------------------------------- /docs/static/js/0.d20f7d51.chunk.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../static/js/0.d20f7d51.chunk.js","views/admin/page3.jsx"],"names":["webpackJsonp","228","module","__webpack_exports__","__webpack_require__","Page3","__WEBPACK_IMPORTED_MODULE_0_react___default","a","createElement","Object","defineProperty","value","__WEBPACK_IMPORTED_MODULE_0_react__","n"],"mappings":"AAAAA,cAAc,IAERC,IACA,SAAUC,EAAQC,EAAqBC,GAE7C,YCHe,SAASC,KACtB,MAAOC,GAAAC,EAAAC,cAAA,0BDGTC,OAAOC,eAAeP,EAAqB,cAAgBQ,OAAO,IACjCR,EAA6B,QAAIE,CAC7C,IAAIO,GAAsCR,EAAoB,GAC1DE,EAA8CF,EAAoBS,EAAED","file":"static/js/0.d20f7d51.chunk.js","sourcesContent":["webpackJsonp([0],{\n\n/***/ 228:\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony export (immutable) */ __webpack_exports__[\"default\"] = Page3;\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(0);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__);\nfunction Page3(){return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('div',null,'Admin Page3');}\n\n/***/ })\n\n});\n\n\n// WEBPACK FOOTER //\n// static/js/0.d20f7d51.chunk.js","import React from 'react'\r\n\r\nexport default function Page3 () {\r\n return
Admin Page3
\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ./docs-src/views/admin/page3.jsx"],"sourceRoot":""} -------------------------------------------------------------------------------- /docs-src/views/admin/page2.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { TransitionGroup, CSSTransition } from 'react-transition-group' 3 | 4 | export default class Page2 extends React.Component { 5 | state = { 6 | items: [1, 2], 7 | test: true 8 | } 9 | 10 | add () { 11 | // const list = this.state.items.push(1) 12 | this.setState({ items: [...this.state.items, 1] }) 13 | } 14 | 15 | reduce () { 16 | const list = [...this.state.items] 17 | list.pop() 18 | this.setState({ items: list }) 19 | } 20 | 21 | render () { 22 | return ( 23 |
24 |
Admin Page2
25 |
26 |
27 | 28 | 29 |

30 | 31 | {/* 32 | 33 | {this.state.items.map((e, index) => { 34 | return (
item {index}
) 35 | })} 36 |
37 |
*/} 38 | 39 | 40 | { 41 | this.state.items.map((e, index) => { 42 | return ( 43 | 44 |
item {index}
45 |
46 | ) 47 | }) 48 | } 49 |
50 | 51 |
52 |
53 | ) 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 22 | A concise router base on react-router. 23 | 24 | 25 | 28 |
29 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /docs/static/css/main.5c32c3f2.css: -------------------------------------------------------------------------------- 1 | .fade-in-enter{opacity:0;-webkit-transform:translateY(100px);-ms-transform:translateY(100px);transform:translateY(100px)}.fade-in-enter-active{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);-webkit-transition:all .3s ease-in-out;-o-transition:all ease-in-out .3s;transition:all .3s ease-in-out}.fade-in-exit{opacity:1}.fade-in-exit-active{opacity:0;-webkit-transform:translateY(100px);-ms-transform:translateY(100px);transform:translateY(100px);-webkit-transition:all .3s ease-in-out;-o-transition:all ease-in-out .3s;transition:all .3s ease-in-out}a{margin:0 5px}.demo-block{width:600px;min-height:300px;border:1px solid #1fadf2;padding:15px;margin:0 auto}.link-active{font-weight:700;color:#e04843}.anim-list .anim-item{margin-bottom:10px;background:#ddd;padding:10px}#nprogress{pointer-events:none}#nprogress .bar{background:#29d;position:fixed;z-index:1031;top:0;left:0;width:100%;height:2px}#nprogress .peg{display:block;position:absolute;right:0;width:100px;height:100%;-webkit-box-shadow:0 0 10px #29d,0 0 5px #29d;box-shadow:0 0 10px #29d,0 0 5px #29d;opacity:1;-webkit-transform:rotate(3deg) translateY(-4px);-ms-transform:rotate(3deg) translateY(-4px);transform:rotate(3deg) translateY(-4px)}#nprogress .spinner{display:block;position:fixed;z-index:1031;top:15px;right:15px}#nprogress .spinner-icon{width:18px;height:18px;-webkit-box-sizing:border-box;box-sizing:border-box;border:2px solid transparent;border-top-color:#29d;border-left-color:#29d;border-radius:50%;-webkit-animation:nprogress-spinner .4s linear infinite;animation:nprogress-spinner .4s linear infinite}.nprogress-custom-parent{overflow:hidden;position:relative}.nprogress-custom-parent #nprogress .bar,.nprogress-custom-parent #nprogress .spinner{position:absolute}@-webkit-keyframes nprogress-spinner{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes nprogress-spinner{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}} 2 | /*# sourceMappingURL=main.5c32c3f2.css.map*/ -------------------------------------------------------------------------------- /config/paths.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const path = require('path'); 4 | const fs = require('fs'); 5 | const url = require('url'); 6 | 7 | // Make sure any symlinks in the project folder are resolved: 8 | // https://github.com/facebookincubator/create-react-app/issues/637 9 | const appDirectory = fs.realpathSync(process.cwd()); 10 | const resolve = relativePath => path.resolve(appDirectory, relativePath); 11 | 12 | const envPublicUrl = process.env.PUBLIC_URL; 13 | 14 | function ensureSlash(path, needsSlash) { 15 | const hasSlash = path.endsWith('/'); 16 | if (hasSlash && !needsSlash) { 17 | return path.substr(path, path.length - 1); 18 | } else if (!hasSlash && needsSlash) { 19 | return `${path}/`; 20 | } else { 21 | return path; 22 | } 23 | } 24 | 25 | const getPublicUrl = appPackageJson => 26 | envPublicUrl || require(appPackageJson).homepage; 27 | 28 | // We use `PUBLIC_URL` environment variable or "homepage" field to infer 29 | // "public path" at which the app is served. 30 | // Webpack needs to know it to put the right