【发布时间】:2021-05-08 14:20:36
【问题描述】:
我编写这段代码是为了在我的 Nuxt 应用程序中使用 Vue-CoolLightBox。
我使用npm install --save vue-cool-lightbox在我的 Nuxt 应用程序中安装了它
<template>
<div>
<CoolLightBox
:items="items"
:index="index"
@close="index = null">
</CoolLightBox>
<div class="images-wrapper">
<div
class="image"
v-for="(image, imageIndex) in items"
:key="imageIndex"
@click="index = imageIndex"
:style="{ backgroundImage: 'url(' + image + ')' }"
></div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
images: [
'https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__340.jpg',
'https://static.toiimg.com/photo/72975551.cms',
],
index: null
};
},
};
</script>
问题是图像没有加载到页面中,或者图像数组没有与组件项绑定。这里有什么问题?
【问题讨论】:
标签: node.js vue.js vue-component nuxt.js lightbox