我编写这段代码是为了在我的 Nuxt 应用程序中使用 Vue-CoolLightBox。
我使用 npm install --save vue-cool-lightbox
<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>
问题是图像没有加载到页面中或者图像数组没有与组件项绑定。这里有什么问题?