5 #fenDiv(v-if="!!vr") {{ vr.getFen() }}
7 .col-sm-12.col-md-10.col-md-offset-1
8 BaseGame(:game="game" :vr="vr" ref="basegame")
12 import BaseGame from "@/components/BaseGame.vue";
13 import { store } from "@/store";
14 import { ArrayFun } from "@/utils/array";
21 // gameRef: to find the game in (potentially remote) storage
25 gameRef: { //given in URL (rid = remote ID)
30 players:[{name:"Analyze"},{name:"Analyze"}],
33 vr: null, //"variant rules" object initialized from FEN
34 //people: [], //players + observers //TODO later: interactive analyze...
38 "$route": function(to, from) {
39 this.gameRef.fen = to.query["fen"].replace(/_/g, " ");
40 this.gameRef.vname = to.params["vname"];
45 this.gameRef.fen = this.$route.query["fen"].replace(/_/g, " ");
46 this.gameRef.vname = this.$route.params["vname"];
50 loadGame: async function() {
51 this.game.vname = this.gameRef.vname;
52 this.game.fen = this.gameRef.fen;
53 const vModule = await import("@/variants/" + this.game.vname + ".js");
54 window.V = vModule.VariantRules;
55 this.vr = new V(this.game.fen);
56 // fenStart initialized in the end, after definition of V,
57 // because it triggers a reset on BaseGame component.
58 this.$set(this.game, "fenStart", this.gameRef.fen); //TODO: Vue3...