frontend: serialize current page to hash instead of query (and use setters for it)
continuous-integration/drone/push Build is passing Details

master
Simon Bruder 2019-07-16 15:46:16 +00:00
parent 23a04a3b52
commit 83234769d6
No known key found for this signature in database
GPG Key ID: 6F03E0000CC5B62F
1 changed files with 11 additions and 6 deletions

View File

@ -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
}
},