X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fmain.js;h=4659a5b0f2e014c940649d7438dd364f179916eb;hp=1fe69b2b5e4fdd282a8ecbdbc3bd8a964616e2fe;hb=590b75f9860a539d11906521fd25cacad05ab0a8;hpb=b644ef7f0302dcb024e5214600d13883906faed0 diff --git a/client/src/main.js b/client/src/main.js index 1fe69b2b..4659a5b0 100644 --- a/client/src/main.js +++ b/client/src/main.js @@ -24,6 +24,10 @@ new Vue({ Vue.prototype.$tr = tModule.translations; //console.log(tModule.translations); }, + $route: function(newRoute) { + console.log(this.$route.params); + //TODO: conn.send("enter", newRoute) + }, }, created: function() { const supportedLangs = ["en","es","fr"]; @@ -31,9 +35,7 @@ new Vue({ supportedLangs.includes(navigator.language) ? navigator.language : "en"; - ajax("/variants", "GET", res => { - Vue.prototype.$variants = res.variantArray; - }); + ajax("/variants", "GET", res => { Vue.prototype.$variants = res.variantArray; }); Vue.prototype.$tr = {}; //to avoid a compiler error // TODO: if there is a socket ID in localStorage, it means a live game was interrupted (and should resume) const myid = localStorage["myid"] || util.getRandString(); @@ -63,10 +65,4 @@ new Vue({ // game : aussi systématique // problems: on-demand // -// It works (to watch for route change), in a component: -//watch: { -// $route: function(newRoute) { -// console.log(this.$route.params); -// }, -//}, // See https://router.vuejs.org/guide/essentials/dynamic-matching.html#reacting-to-params-changes