懒加载
v-lazy
组件用于根据元素的可见性动态加载组件。
v-lazy
组件使用 v-intersect 指令,该指令需要 Polyfill 才能在 IE11 / Safari 上运行。 在某些iOS 版本上可能还需要使用此 polyfill。
用例
默认情况下,v-lazy
组件在被相交之前不会渲染其内容。 向下滚动并查看元素经过时的渲染。
template script
<template>
<v-responsive
class="overflow-y-auto"
max-height="400"
>
<div class="pa-6 text-center">
Scroll down
</div>
<v-responsive
height="200vh"
class="text-center pa-2"
>
<v-responsive min-height="50vh"></v-responsive>
<div class="text-center body-2 mb-12">The card will appear below:</div>
<v-lazy
v-model="isActive"
:options="{
threshold: .5
}"
min-height="200"
transition="fade-transition"
>
<v-card
class="mx-auto"
max-width="336"
>
<v-card-title>Card title</v-card-title>
<v-card-text>
Phasellus magna. Quisque rutrum. Nunc egestas, augue at pellentesque laoreet, felis eros vehicula leo, at malesuada velit leo quis pede. Aliquam lobortis. Quisque libero metus, condimentum nec, tempor a, commodo mollis, magna.
In turpis. In dui magna, posuere eget, vestibulum et, tempor auctor, justo. In turpis. Pellentesque dapibus hendrerit tortor. Ut varius tincidunt libero.
</v-card-text>
</v-card>
</v-lazy>
</v-responsive>
</v-responsive>
</template>
<script>
export default {
data: () => ({
isActive: false,
}),
}
</script>
API
从下面选择您想要的组件,并查看可用的属性、插槽、事件和函数。