lucaspulliese / vue-cool-lightbox

Vue.js lightbox inspired by fancybox.
https://vue-cool-lightbox.lucaspulliese.com
341 stars 55 forks source link

(fix) Avoid sometimes throwing the exceptions when the image list is … #141

Open charles-liang opened 1 year ago

charles-liang commented 1 year ago

I'm using nuxt content to render the page and sometimes it throws an exception that the childnodes are empty, which causes my whole page to go blank.

I not sure how to trigger, maybe the page hasn't finished loading yet, but I mouse clicked around

I've added a way to avoid throwing this exception by determining in advance if the childnode is empty

charles-liang commented 1 year ago
image
charles-liang commented 1 year ago

The second commit is to fix that

when the viewer is closed, but the startSwipe function is triggered, and the imgIndex is null.

it will cause the continueSwipe to be triggered automatically, at next openning the viewer. because the isDraggingSwipe set to true at last time but imgIndex was null, and endSwipe not called to make the isDraggingSwipe false.