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