|
|
@@ -185,6 +185,7 @@ export default {
|
|
185
|
185
|
this.loading = false
|
|
186
|
186
|
},
|
|
187
|
187
|
_setClick(el, cb) {
|
|
|
188
|
+ el.dataset.gallery = index
|
|
188
|
189
|
if (el.addEventListener) {
|
|
189
|
190
|
el.addEventListener('click', cb, false)
|
|
190
|
191
|
} else {
|
|
|
@@ -208,20 +209,19 @@ export default {
|
|
208
|
209
|
await nextTick()
|
|
209
|
210
|
const galleries = section.querySelectorAll('.wp-block-gallery')
|
|
210
|
211
|
galleries.forEach((gallery, galleryIndex) => {
|
|
211
|
|
- el.dataset.gallery = galleryIndex
|
|
212
|
212
|
gallery.querySelectorAll('img').forEach(image =>
|
|
213
|
|
- this._setClick(image, e => {
|
|
214
|
|
- this.activeGalleryIndex = parseInt(
|
|
215
|
|
- e.target.dataset.gallery,
|
|
216
|
|
- )
|
|
217
|
|
- const galleryImages =
|
|
218
|
|
- this.singlePost.galleries[this.activeGalleryIndex]
|
|
|
213
|
+ this._setClick(image, galleryIndex, e => {
|
|
|
214
|
+ this.activeGalleryIndex = e.target.dataset.gallery
|
|
|
215
|
+
|
|
|
216
|
+ const activeGallery =
|
|
|
217
|
+ post.galleries[this.activeGalleryIndex]
|
|
|
218
|
+
|
|
|
219
|
+ console.log(post.galleries)
|
|
|
220
|
+ console.log(activeGallery)
|
|
219
|
221
|
|
|
220
|
|
- console.log(this.singlePost.galleries)
|
|
221
|
|
- console.log(galleryImages)
|
|
222
|
|
- if (!galleryImages.ids) return
|
|
|
222
|
+ if (!activeGallery.ids) return
|
|
223
|
223
|
|
|
224
|
|
- this.activeImageIndex = galleryImages.ids.indexOf(
|
|
|
224
|
+ this.activeImageIndex = activeGallery.ids.indexOf(
|
|
225
|
225
|
parseInt(e.target.dataset.id),
|
|
226
|
226
|
)
|
|
227
|
227
|
console.log(
|