[英]Not sure how to use lightbox in my vue project?
I'm currently trying to use lightbox in my project!我目前正在尝试在我的项目中使用灯箱! And as you notice I using a (v-for) for the items array.
正如您所注意到的,我对 items 数组使用了 (v-for)。
How to integrated lightbox with v-for items?如何将灯箱与 v-for 项目集成?
vue-image-lightbox A simple image lightbox component for Vuejs https://www.npmjs.com/package/vue-image-lightbox vue-image-lightbox 一个简单的 Vuejs 图片灯箱组件https://www.npmjs.com/package/vue-image-lightbox
<div class="items" v-scroll-reveal.reset>
<md-card
v-for="(product,index) in products"
:key="index"
v-show="product.type === activeProduct">
<md-card-media md-ratio="16:9">
<img :src="require(`../assets/img/products/${product.img}`)"/>
</md-card-media>
</md-card>
</div>
Replace the img
with <LightBox :images="images"></LightBox>
.将
img
替换为<LightBox :images="images"></LightBox>
。 As per the examples in the npm page, the images
variable is an object that holds multiple resolutions of the picture.根据 npm 页面中的示例,
images
变量是一个保存图片多种分辨率的对象。
The elements should be rendered automatically afterwards.元素应该在之后自动呈现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.