2023-05-05 06:41:49 +00:00
|
|
|
<template>
|
|
|
|
<DocSectionText v-bind="$attrs"></DocSectionText>
|
|
|
|
<div class="card flex justify-content-center">
|
|
|
|
<VirtualScroller
|
|
|
|
:items="items"
|
|
|
|
:itemSize="50"
|
|
|
|
:pt="{
|
|
|
|
root: {
|
|
|
|
class: 'border-1 surface-border border-round',
|
|
|
|
style: { width: '200px', height: '200px' }
|
|
|
|
}
|
|
|
|
}"
|
|
|
|
>
|
|
|
|
<template v-slot:item="{ item, options }">
|
|
|
|
<div :class="['flex align-items-center p-2', { 'surface-hover': options.odd }]" style="height: 50px">{{ item }}</div>
|
|
|
|
</template>
|
|
|
|
</VirtualScroller>
|
|
|
|
</div>
|
|
|
|
<DocSectionCode :code="code" />
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
items: null,
|
|
|
|
code: {
|
2023-09-22 12:54:14 +00:00
|
|
|
basic: `
|
|
|
|
<VirtualScroller
|
2023-05-05 06:41:49 +00:00
|
|
|
:items="items"
|
|
|
|
:itemSize="50"
|
|
|
|
:pt="{
|
|
|
|
root: {
|
|
|
|
class: 'border-1 surface-border border-round',
|
|
|
|
style: { width: '200px', height: '200px' }
|
|
|
|
}
|
|
|
|
}"
|
|
|
|
>`,
|
2023-09-22 12:54:14 +00:00
|
|
|
options: `
|
|
|
|
<template>
|
2023-05-05 06:41:49 +00:00
|
|
|
<div class="card flex justify-content-center">
|
|
|
|
<VirtualScroller
|
|
|
|
:items="items"
|
|
|
|
:itemSize="50"
|
|
|
|
:pt="{
|
|
|
|
root: {
|
|
|
|
class: 'border-1 surface-border border-round',
|
|
|
|
style: { width: '200px', height: '200px' }
|
|
|
|
}
|
|
|
|
}"
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
items: null
|
|
|
|
};
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.items = Array.from({ length: 100000 }).map((_, i) => \`Item #\${i}\`);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
<\/script>`,
|
2023-09-22 12:54:14 +00:00
|
|
|
composition: `
|
|
|
|
<template>
|
2023-05-05 06:41:49 +00:00
|
|
|
<div class="card flex justify-content-center">
|
|
|
|
<VirtualScroller
|
|
|
|
:items="items"
|
|
|
|
:itemSize="50"
|
|
|
|
:pt="{
|
|
|
|
root: {
|
|
|
|
class: 'border-1 surface-border border-round',
|
|
|
|
style: { width: '200px', height: '200px' }
|
|
|
|
}
|
|
|
|
}"
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
import { ref } from 'vue';
|
|
|
|
|
|
|
|
const items = ref(Array.from({ length: 100000 }).map((_, i) => \`Item #\${i}\`));
|
|
|
|
<\/script>`
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.items = Array.from({ length: 100000 }).map((_, i) => `Item #${i}`);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|