This commit is contained in:
10
src/App.vue
10
src/App.vue
@@ -41,9 +41,7 @@ export default {
|
|||||||
this.updateMobile();
|
this.updateMobile();
|
||||||
|
|
||||||
//Set initial page
|
//Set initial page
|
||||||
let asInitHash = this.getBrowserHash();
|
this.setVarHash(this.validateRoute(this.getBrowserHash()));
|
||||||
if(!asInitHash.page) asInitHash.page = this.consts.default_page;
|
|
||||||
this.setVarHash(asInitHash);
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
//Catch browser hash change
|
//Catch browser hash change
|
||||||
@@ -51,7 +49,7 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
hashSnapshot(jNewHash, jOldHash) {
|
hashSnapshot(jNewHash, jOldHash) {
|
||||||
const asNewHash = JSON.parse(jNewHash);
|
const asNewHash = this.validateRoute(JSON.parse(jNewHash));
|
||||||
|
|
||||||
//Sync variable -> #hash
|
//Sync variable -> #hash
|
||||||
if(asNewHash != this.getBrowserHash()) {
|
if(asNewHash != this.getBrowserHash()) {
|
||||||
@@ -97,6 +95,10 @@ export default {
|
|||||||
},
|
},
|
||||||
getPrevAnchor() {
|
getPrevAnchor() {
|
||||||
return this.getAnchor([this.hash.prev.page, ...this.hash.prev.items]);
|
return this.getAnchor([this.hash.prev.page, ...this.hash.prev.items]);
|
||||||
|
},
|
||||||
|
validateRoute(asHash) {
|
||||||
|
if(!Object.keys(aoRoutes).includes(asHash.page)) asHash.page = this.consts.default_page;
|
||||||
|
return asHash;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
|
|||||||
Reference in New Issue
Block a user