Skip to content

Commit 087424b

Browse files
committed
fix(lightbox): fix siteloading and v-lazy
1 parent 3c1f556 commit 087424b

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ How to use:
148148
<tr>
149149
<td>siteLoading</td>
150150
<td></td>
151-
<td>null</td>
151+
<td>String</td>
152152
<td>default image when your image is error or loading</td>
153153
</tr>
154154
<tr>

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-image-lightbox",
33
"description": "A Vue.js package to display an image gallery lightbox",
4-
"version": "7.1.0",
4+
"version": "7.1.1",
55
"author": "Nguyen P. Thien Dzung <[email protected]>",
66
"license": "MIT",
77
"main": "dist/vue-image-lightbox.min.js",

src/App.vue

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
:media="media"
2525
:show-caption="true"
2626
:show-light-box="false"
27+
:site-loading="siteLoading"
2728
/>
2829
</div>
2930
</div>

src/components/LightBox.vue

+13-6
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@
3131
<img
3232
v-if="media[select].type !== 'video'"
3333
:key="media[select].src"
34-
:src="media[select].src"
34+
v-lazy="{
35+
src: media[select].src,
36+
loading: media[select].src,
37+
error: media[select].src,
38+
}"
3539
:srcset="media[select].srcset || ''"
3640
class="vue-lb-modal-image"
3741
:alt="media[select].caption"
@@ -99,8 +103,8 @@
99103
<div
100104
v-for="(image, index) in imagesThumb"
101105
v-show="index >= thumbIndex.begin && index <= thumbIndex.end"
102-
:key="typeof image.thumb === 'string' ? `${image.thumb}${index}` : index"
103-
v-lazy:background-image="image.thumb"
106+
:key="typeof image.src === 'string' ? `${image.src}${index}` : index"
107+
v-lazy:background-image="image"
104108
:class="'vue-lb-modal-thumbnail' + (select === index ? '-active' : '')"
105109
@click.stop="showImage(index)"
106110
>
@@ -220,8 +224,8 @@ export default {
220224
},
221225
222226
siteLoading: {
223-
type: Object,
224-
default: null,
227+
type: String,
228+
default: '',
225229
},
226230
227231
showCaption: {
@@ -300,7 +304,10 @@ export default {
300304
}))
301305
}
302306
303-
return this.media.map(({ thumb, type }) => ({ thumb, type }))
307+
return this.media.map(({ thumb, type }) => ({
308+
src: thumb,
309+
type,
310+
}))
304311
}
305312
},
306313

0 commit comments

Comments
 (0)