From 5bcd8063ee1dbf0df5af6b4e19e7498ba69d3e58 Mon Sep 17 00:00:00 2001 From: Remy Raes Date: Thu, 20 Oct 2022 00:55:09 +0200 Subject: feat: add router config --- src-vue/src/main.ts | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src-vue/src/main.ts b/src-vue/src/main.ts index 0ac31a2d..623b175d 100644 --- a/src-vue/src/main.ts +++ b/src-vue/src/main.ts @@ -2,14 +2,21 @@ import { createApp } from 'vue' import App from './App.vue' import ElementPlus from "element-plus"; import * as ElementPlusIconsVue from '@element-plus/icons-vue' +import { store } from './plugins/store'; +import PlayView from "./views/PlayView.vue"; +import ChangelogView from "./views/ChangelogView.vue"; +import SettingsView from "./views/SettingsView.vue"; +import DeveloperView from "./views/DeveloperView.vue"; +import {createRouter, createWebHashHistory} from "vue-router"; + + +const app = createApp(App); // styles import 'element-plus/theme-chalk/index.css'; import './style.css' -import { store } from './plugins/store'; -const app = createApp(App); app.use(ElementPlus); // icons @@ -20,4 +27,19 @@ for (const [key, component] of Object.entries(ElementPlusIconsVue)) { // style app.use( store, '$store' ); + +// routes +const routes = [ + { path: '/', name: 'Main', component: () => PlayView}, + { path: '/changelog', name: 'Changelog', component: () => ChangelogView}, + { path: '/settings', name: 'Settings', component: () => SettingsView}, + { path: '/dev', name: 'Dev', component: () => DeveloperView} +]; +const router = createRouter({ + history: createWebHashHistory(), + routes, // short for `routes: routes` +}); +app.use(router); + + app.mount('#app') -- cgit v1.2.3