Closed StringKe closed 4 years ago
When I replace items
=> detail.data
, I get the following error, TypeError: Cannot read property 'preview' of undefined.
<vue-masonry-wall
:items="detail.data"
:options="options"
v-if="childrenLoad"
>
<template v-slot:default="{ item }">
<div class="item bg-width rounded overflow-hidden">
<img :src="assetsUrl(item.preview)" alt="bg" />
</div>
</template>
</vue-masonry-wall>
When I replace
items
=>detail.data
, I get the following error, TypeError: Cannot read property 'preview' of undefined.<vue-masonry-wall :items="detail.data" :options="options" v-if="childrenLoad" > <template v-slot:default="{ item }"> <div class="item bg-width rounded overflow-hidden"> <img :src="assetsUrl(item.preview)" alt="bg" /> </div> </template> </vue-masonry-wall>
I use v-if
to reload without this problem
When options.width = 0
enable fixed number of columns?
const length = Math.round(this.$refs.wall.scrollWidth / this._options.width)
change
const length = this._options.width != 0 ? Math.round(this.$refs.wall.scrollWidth / this._options.width) : this._options.cloumn;
Try to read the width of the parent element after the page loads? I am not sure about my width but I know that I need two columns to display the content