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