it-tools/src/router.ts

21 lines
667 B
TypeScript
Raw Normal View History

2022-04-04 00:24:45 +02:00
import { layouts } from './layouts/index';
2022-03-31 00:33:29 +02:00
import { createRouter, createWebHistory } from 'vue-router';
import HomePage from './pages/Home.page.vue';
2022-04-05 17:40:35 +02:00
import NotFound from './pages/404.page.vue';
2022-03-31 00:33:29 +02:00
import { tools } from './tools';
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
name: 'home',
component: HomePage,
},
2022-04-04 00:24:45 +02:00
...tools.map(({ path, name, component, ...config }) => ({ path, name, component, meta: { isTool: true, layout: layouts.toolLayout, name, ...config } })),
2022-04-05 17:40:35 +02:00
{ path: '/:pathMatch(.*)*', name: 'NotFound', component: NotFound },
2022-03-31 00:33:29 +02:00
],
});
export default router;