Use shorthand syntax in main.js routes

This commit is contained in:
QWp6t
2016-07-16 10:14:57 -07:00
parent 339cc8e01e
commit 320c6916dc
2 changed files with 7 additions and 7 deletions

View File

@@ -1,8 +1,8 @@
import $ from 'jquery'; import $ from 'jquery';
import Router from './util/router'; import Router from './util/router';
import Common from './routes/Common'; import common from './routes/Common';
import Home from './routes/Home'; import home from './routes/Home';
import About from './routes/About'; import about_us from './routes/About';
// Import Bootstrap // Import Bootstrap
import 'bootstrap/dist/js/umd/util.js'; import 'bootstrap/dist/js/umd/util.js';
@@ -21,11 +21,11 @@ import 'bootstrap/dist/js/umd/popover.js';
// rename this variable, you will also need to rename the namespace below. // rename this variable, you will also need to rename the namespace below.
const routes = { const routes = {
// All pages // All pages
common: Common, common,
// Home page // Home page
home: Home, home,
// About us page, note the change from about-us to about_us. // About us page, note the change from about-us to about_us.
about_us: About about_us
}; };
// Load Events // Load Events

View File

@@ -14,7 +14,7 @@ export default class Router {
} }
fire(route, fn = 'init', args) { fire(route, fn = 'init', args) {
let fire = route !== '' && this.routes[route] && typeof this.routes[route][fn] === 'function'; const fire = route !== '' && this.routes[route] && typeof this.routes[route][fn] === 'function';
if (fire) { if (fire) {
this.routes[route][fn](args); this.routes[route][fn](args);
} }