Last active
September 29, 2019 15:55
-
-
Save smolinari/a8b87ad85c11720877a978c66789f051 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<q-virtual-scroll | |
style="max-height: 300px;" | |
:items="heavyList" | |
separator | |
> | |
<template v-slot="{ item, index }"> | |
<q-item | |
:key="index" | |
dense | |
> | |
<q-item-section> | |
<q-item-label> | |
#{{ index }} - {{ item.label }} | |
</q-item-label> | |
</q-item-section> | |
</q-item> | |
</template> | |
</q-virtual-scroll> | |
</template> | |
<script> | |
const maxSize = 10000 | |
const heavyList = [] | |
for (let i = 0; i < maxSize; i++) { | |
heavyList.push({ | |
label: 'Option ' + (i + 1) | |
}) | |
} | |
// optional but good for performance | |
// if you don't intend to change anything | |
// in heavyList: | |
Object.freeze(heavyList) | |
export default { | |
data () { | |
return { | |
heavyList | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment