Skip to content

Commit

Permalink
fix(lightbox): fix siteloading and v-lazy
Browse files Browse the repository at this point in the history
  • Loading branch information
pexea12 committed Jul 8, 2020
1 parent 3c1f556 commit 087424b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ How to use:
<tr>
<td>siteLoading</td>
<td></td>
<td>null</td>
<td>String</td>
<td>default image when your image is error or loading</td>
</tr>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue-image-lightbox",
"description": "A Vue.js package to display an image gallery lightbox",
"version": "7.1.0",
"version": "7.1.1",
"author": "Nguyen P. Thien Dzung <dzungnguyenvn@outlook.com>",
"license": "MIT",
"main": "dist/vue-image-lightbox.min.js",
Expand Down
1 change: 1 addition & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
:media="media"
:show-caption="true"
:show-light-box="false"
:site-loading="siteLoading"
/>
</div>
</div>
Expand Down
19 changes: 13 additions & 6 deletions src/components/LightBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
<img
v-if="media[select].type !== 'video'"
:key="media[select].src"
:src="media[select].src"
v-lazy="{
src: media[select].src,
loading: media[select].src,
error: media[select].src,
}"
:srcset="media[select].srcset || ''"
class="vue-lb-modal-image"
:alt="media[select].caption"
Expand Down Expand Up @@ -99,8 +103,8 @@
<div
v-for="(image, index) in imagesThumb"
v-show="index >= thumbIndex.begin && index <= thumbIndex.end"
:key="typeof image.thumb === 'string' ? `${image.thumb}${index}` : index"
v-lazy:background-image="image.thumb"
:key="typeof image.src === 'string' ? `${image.src}${index}` : index"
v-lazy:background-image="image"
:class="'vue-lb-modal-thumbnail' + (select === index ? '-active' : '')"
@click.stop="showImage(index)"
>
Expand Down Expand Up @@ -220,8 +224,8 @@ export default {
},
siteLoading: {
type: Object,
default: null,
type: String,
default: '',
},
showCaption: {
Expand Down Expand Up @@ -300,7 +304,10 @@ export default {
}))
}
return this.media.map(({ thumb, type }) => ({ thumb, type }))
return this.media.map(({ thumb, type }) => ({
src: thumb,
type,
}))
}
},
Expand Down

0 comments on commit 087424b

Please sign in to comment.