Files
mixtape/zero.Web/router.js
T

45 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-03-22 14:18:34 +01:00
import Vue from 'vue';
import VueRouter from 'vue-router';
2020-04-08 16:14:12 +02:00
import ViewSettings from 'zeropages/settings';
import ViewSettingsUser from 'zeropages/settings/user';
import ViewDefault from 'zeropages/page';
2020-04-10 15:47:29 +02:00
import ViewLists from 'zeropages/lists';
2020-04-11 16:47:51 +02:00
//import MyPluginRoutes from './Plugins/MyPlugin/Routes';
2020-04-08 16:14:12 +02:00
2020-03-22 14:18:34 +01:00
Vue.use(VueRouter);
history.scrollRestoration = 'manual';
2020-04-11 16:47:51 +02:00
let routes = [
2020-04-08 16:14:12 +02:00
{ path: '/settings/user', component: ViewSettingsUser },
{ path: '/settings*', component: ViewSettings },
2020-04-10 15:47:29 +02:00
{ path: '/lists', component: ViewLists },
2020-04-08 16:14:12 +02:00
{ path: '*', component: ViewDefault }
2020-03-22 14:18:34 +01:00
];
2020-04-11 16:47:51 +02:00
//MyPluginRoutes.forEach(route =>
//{
// routes.push(route);
//});
2020-04-11 16:41:56 +02:00
2020-03-22 14:18:34 +01:00
const router = new VueRouter({
mode: 'history',
routes: routes,
2020-04-06 00:49:09 +02:00
base: zero.path,
linkActiveClass: 'is-active',
linkExactActiveClass: 'is-active-exact',
2020-03-22 14:18:34 +01:00
scrollBehavior(to, from, savedPosition)
{
return savedPosition ? savedPosition : { x: 0, y: 0 };
}
});
2020-04-06 00:49:09 +02:00
//router.beforeEach((to, from, next) =>
//{
// document.title = to.meta.title !== null ? to.meta.title + " | fifty" : "fifty";
// EventHub.$emit('dialog-close');
// next();
//});
2020-03-22 14:18:34 +01:00
export default router;