|
@@ -1,5 +1,7 @@
|
|
|
import Vue from 'vue';
|
|
|
import VueRouter from 'vue-router';
|
|
|
+import _ from 'lodash';
|
|
|
+
|
|
|
import App from './components/App.vue';
|
|
|
import CardIndex from './components/CardIndex/CardIndex.vue';
|
|
|
import Reader from './components/Reader/Reader.vue';
|
|
@@ -10,19 +12,27 @@ import Settings from './components/Settings/Settings.vue';
|
|
|
import Help from './components/Help/Help.vue';
|
|
|
import NotFound404 from './components/NotFound404/NotFound404.vue';
|
|
|
|
|
|
-Vue.use(VueRouter);
|
|
|
-
|
|
|
-let routes = [
|
|
|
- { path: '/', redirect: '/cardindex' },
|
|
|
- { path: '/cardindex', component: CardIndex },
|
|
|
- { path: '/reader', component: Reader },
|
|
|
- { path: '/income', component: Income },
|
|
|
- { path: '/sources', component: Sources },
|
|
|
- { path: '/settings', component: Settings },
|
|
|
- { path: '/help', component: Help },
|
|
|
- { path: '*', component: NotFound404 },
|
|
|
+const myRoutes = [
|
|
|
+ ['/', null, null, '/cardindex'],
|
|
|
+ ['/cardindex', CardIndex ],
|
|
|
+ ['/reader', Reader ],
|
|
|
+ ['/income', Income ],
|
|
|
+ ['/sources', Sources ],
|
|
|
+ ['/settings', Settings ],
|
|
|
+ ['/help', Help ],
|
|
|
+ ['*', NotFound404 ],
|
|
|
];
|
|
|
|
|
|
+let routes = [];
|
|
|
+
|
|
|
+for (let route of myRoutes) {
|
|
|
+ const [path, component, name, redirect] = route;
|
|
|
+ let r = _.pickBy({path, component, name, redirect}, _.identity);
|
|
|
+ routes.push(r);
|
|
|
+}
|
|
|
+
|
|
|
+Vue.use(VueRouter);
|
|
|
+
|
|
|
export default new VueRouter({
|
|
|
routes
|
|
|
});
|