Fix back button -again-
All checks were successful
Deploy Spot / deploy (push) Successful in 35s

This commit is contained in:
2026-06-11 15:57:42 +02:00
parent 9718713eb4
commit 7ecd8094e2

View File

@@ -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() {