Use shorthand syntax in main.js routes
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user