Skip to content

Instantly share code, notes, and snippets.

@smolinari
Last active September 29, 2019 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smolinari/a8b87ad85c11720877a978c66789f051 to your computer and use it in GitHub Desktop.
Save smolinari/a8b87ad85c11720877a978c66789f051 to your computer and use it in GitHub Desktop.
<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