Draft of Rules view (not working) with computer play
[vchess.git] / client / src / router.js
1 import Vue from "vue";
2 import Router from "vue-router";
3 import Hall from "./views/Hall.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: "hall",
16 component: Hall,
17 },
18 {
19 path: "/variants",
20 name: "variants",
21 component: loadView("Variants"),
22 },
23 {
24 path: "/variants/:vname([a-zA-Z0-9]+)",
25 name: "rules",
26 component: loadView("Rules"),
27 },
28 // {
29 // path: "/about",
30 // name: "about",
31 // // route level code-splitting
32 // // this generates a separate chunk (about.[hash].js) for this route
33 // // which is lazy-loaded when the route is visited.
34 // component: loadView('About'),
35 // //function() {
36 // // return import(/* webpackChunkName: "about" */ "./views/About.vue");
37 // //}
38 // },
39 // TODO: gameRef, problemId: https://router.vuejs.org/guide/essentials/dynamic-matching.html
40 ]
41 });