08bbf88ba281350a284334377bedb0e76b9f5d1f
[vchess.git] / client / src / router.js
1 import Vue from "vue";
2 import Router from "vue-router";
3 import Home from "./views/Home.vue";
4
5 Vue.use(Router);
6
7 function loadView(view) {
8 return () => import(/* webpackChunkName: "view-[request]" */ `@/views/${view}.vue`)
9 }
10
11 export default new Router({
12 routes: [
13 {
14 path: "/",
15 name: "home",
16 component: Home,
17 },
18 {
19 path: "/about",
20 name: "about",
21 // route level code-splitting
22 // this generates a separate chunk (about.[hash].js) for this route
23 // which is lazy-loaded when the route is visited.
24 component: loadView('About'),
25 //function() {
26 // return import(/* webpackChunkName: "about" */ "./views/About.vue");
27 //}
28 },
29 {
30 path: "/test",
31 name: "test",
32 component: loadView("Test"),
33 },
34 // TODO: gameRef, problemId: https://router.vuejs.org/guide/essentials/dynamic-matching.html
35 ]
36 });