Files
frost-navigation/src/router/index.js

101 lines
2.3 KiB
JavaScript
Raw Normal View History

2024-08-28 13:01:50 +08:00
import {
createRouter,
createWebHashHistory,
} from 'vue-router';
import {
getToolboxRoutes,
} from '@/assets/js/toolbox-data';
2024-08-29 14:46:06 +08:00
import {
updateAppTitle,
} from '@/assets/js/utils';
2024-08-28 13:01:50 +08:00
import {
ABOUT_MODULE_ENABLED,
ABOUT_MODULE_TITLE,
MC_CTRL_MODULE_ENABLED,
MC_CTRL_MODULE_TITLE,
NAV_MODULE_ENABLED,
NAV_MODULE_TITLE,
SEARCH_MODULE_ENABLED,
SEARCH_MODULE_TITLE,
TOOLBOX_MODULE_ENABLED,
TOOLBOX_MODULE_TITLE,
2024-08-28 13:01:50 +08:00
} from '@/config/modules';
2024-08-26 14:07:57 +08:00
import AboutView from '@/views/AboutView/AboutView.vue';
import IndexView from '@/views/IndexView/IndexView.vue';
export const router = createRouter({
history: createWebHashHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
name: 'IndexView',
component: IndexView,
2024-08-27 20:59:54 +08:00
meta: {
2024-08-30 13:25:29 +08:00
iconClass: 'mdi mdi-home',
2024-08-27 20:59:54 +08:00
showInAside: true,
title: '主页',
},
2024-08-26 14:07:57 +08:00
},
{
2024-08-27 20:59:54 +08:00
path: '/search-view',
name: 'SearchView',
component: () => import('@/views/SearchView/SearchView.vue'),
meta: {
iconClass: 'mdi mdi-magnify',
showInAside: SEARCH_MODULE_ENABLED,
title: SEARCH_MODULE_TITLE,
2024-08-27 20:59:54 +08:00
},
2024-08-26 14:07:57 +08:00
},
{
path: '/nav-view',
name: 'NavView',
component: () => import('@/views/NavView/NavView.vue'),
2024-08-27 20:59:54 +08:00
meta: {
2024-08-30 13:25:29 +08:00
iconClass: 'mdi mdi-compass',
showInAside: NAV_MODULE_ENABLED,
title: NAV_MODULE_TITLE,
2024-08-27 20:59:54 +08:00
},
2024-08-26 14:07:57 +08:00
},
{
path: '/toolbox-view',
name: 'ToolboxView',
component: () => import('@/views/ToolboxView/ToolboxView.vue'),
2024-08-27 20:59:54 +08:00
meta: {
iconClass: 'mdi mdi-tools',
isToolDetail: false,
showInAside: TOOLBOX_MODULE_ENABLED,
title: TOOLBOX_MODULE_TITLE,
2024-08-27 20:59:54 +08:00
},
children: getToolboxRoutes(),
2024-08-27 20:59:54 +08:00
},
{
path: '/minecraft-ctrl-view',
name: 'MinecraftCtrlView',
component: () => import('@/views/MinecraftCtrlView/MinecraftCtrlView.vue'),
meta: {
iconClass: 'mdi mdi-gamepad',
showInAside: MC_CTRL_MODULE_ENABLED,
title: MC_CTRL_MODULE_TITLE,
},
},
2024-08-27 20:59:54 +08:00
{
path: '/about-view',
name: 'AboutView',
component: AboutView,
meta: {
2024-08-30 13:25:29 +08:00
iconClass: 'mdi mdi-information',
showInAside: ABOUT_MODULE_ENABLED,
title: ABOUT_MODULE_TITLE,
2024-08-27 20:59:54 +08:00
},
2024-08-26 14:07:57 +08:00
},
],
});
2024-08-29 14:46:06 +08:00
router.afterEach((to) => {
updateAppTitle(to.meta.title);
});