jog*_*cia 3 javascript vue.js vue-component vuetify.js
我需要对 Vuetify 自动完成进行无限分页。当我滚动到菜单末尾时,从后端加载新的项目页面。
我尝试v-intersect像这样使用指令:
<template>
<v-autocomplete
:items="aBunchOfItems"
item-text="theText"
item-value="theValue"
label="AutoComplete Test"
>
<template v-slot:append-item>
<div v-intersect="onIntersect">
Loading more items ...
</div>
</template>
</v-autocomplete>
</template>
<script>
export default {
methods: {
onIntersect () {
console.log('lol')
},
},
}
</script>
Run Code Online (Sandbox Code Playgroud)
但是,onIntersect()当我单击自动完成功能时,而不是滚动到附加项目时,就会调用该函数。我还尝试了v-lazy将附加项目 div 包装在其中的指令,但这也不起作用。有什么方法可以做到这一点吗?
这是v-intersect的处理程序的预期行为。它在安装和相交时调用。如果您希望仅在相交时调用处理程序,请使用修饰符quiet。
<div v-intersect.quiet="onIntersect">
Loading more items ...
</div>
Run Code Online (Sandbox Code Playgroud)