From e415efe7bc69a05a587ee6c329af1fa3e168911c Mon Sep 17 00:00:00 2001 From: ManjaroOne666 Date: Mon, 28 Jan 2019 12:37:04 +0000 Subject: [PATCH] update page on query string changes --- components/GalleryPage.vue | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/components/GalleryPage.vue b/components/GalleryPage.vue index 93bf720..9a9c8f3 100644 --- a/components/GalleryPage.vue +++ b/components/GalleryPage.vue @@ -68,6 +68,23 @@ export default { } }, + watch: { + $route () { + if (!query || !query.gallery) { return } + const query = this.$route.query + const gallery = parseInt(query.gallery) + const image = parseInt(query.image) || 0 + + if (gallery !== this.activeGalleryIndex) { + this.activeRow = gallery + this.activeGalleryIndex = gallery + } + if (image !== this.activeImageIndex) { + this.activeImageIndex = image + } + } + }, + created () { let query = this.$route.query this.activeGalleryIndex = query.gallery ? parseInt(query.gallery) : 0