From 83234769d6a3f7547db6f4231da5b44839e052e2 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Tue, 16 Jul 2019 15:46:16 +0000 Subject: [PATCH] frontend: serialize current page to hash instead of query (and use setters for it) --- frontend/src/views/Reader.vue | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/frontend/src/views/Reader.vue b/frontend/src/views/Reader.vue index 5521807..4e7606f 100644 --- a/frontend/src/views/Reader.vue +++ b/frontend/src/views/Reader.vue @@ -38,11 +38,16 @@ export default { } }, computed: { - page () { - if (this.$route.query.page) { - return parseInt(this.$route.query.page - 1) - } else { - return 0 + page: { + get () { + if (this.$route.hash) { + return this.$route.hash.substr(1) - 1 + } else { + return 0 + } + }, + set (value) { + this.$router.push({ hash: '#' + (value + 1) }) } } }, @@ -56,7 +61,7 @@ export default { // set page if (page >= 0 && page < this.info.pages.length) { - this.$router.push({ query: { page: page + 1 } }) + this.page = page } },