我想制作一个无限的滚动列表,但它实际上不是延迟加载,被困了几个小时,整个列表就会出现。
.....
<v-col
v-for="(post, i) in posts"
:key="i"
cols="12"
>
<v-lazy
v-model="isActive"
:options="{
threshold: .5
}"
transition="fade-transition"
>
{{Content here}}
</....
用于测试的API:https : //jsonplaceholder.typicode.com/posts
我发现,列必须定义最小高度(约等于卡片的期望高度),以使v-lazy
相交观察器正常工作。使用v-sheet
或v-responsive
来设置min-height
和包含卡片。
此外绑定v-model
的v-lazy
每一个岗位(即:post.isActive),而不是全局isActive
无功...
<v-col lg="3" md="4" sm="6" cols="12" v-for="(post, index) in posts">
<v-sheet min-height="250" class="fill-height" color="transparent">
<v-lazy
v-model="post.isActive" :options="{
threshold: .5
}"
class="fill-height">
<v-card class="fill-height" hover>
<v-card-text>
<v-row :key="index" @click="">
<v-col sm="10" cols="12" class="text-sm-left text-center">
#{{ (index+1) }}
<h2 v-html="post.title"></h2>
<div v-html="post.body"></div>
</v-col>
</v-row>
</v-card-text>
</v-card>
</v-lazy>
</v-sheet>
</v-col>
这工作得很好!!!太谢谢你了!使用文档本身真的无法理解像这样的复杂内容。我已经为此苦苦挣扎了3天,感谢帮助!:D