update page on query string changes

This commit is contained in:
ManjaroOne666 2019-01-28 12:37:04 +00:00
parent 05fd4e9792
commit e415efe7bc
1 changed files with 17 additions and 0 deletions

View File

@ -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 () { created () {
let query = this.$route.query let query = this.$route.query
this.activeGalleryIndex = query.gallery ? parseInt(query.gallery) : 0 this.activeGalleryIndex = query.gallery ? parseInt(query.gallery) : 0