VirtualScroller pt demo added
parent
8de4b8170d
commit
5162ceedd5
|
@ -0,0 +1,95 @@
|
|||
<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: {
|
||||
basic: `
|
||||
<VirtualScroller
|
||||
:items="items"
|
||||
:itemSize="50"
|
||||
:pt="{
|
||||
root: {
|
||||
class: 'border-1 surface-border border-round',
|
||||
style: { width: '200px', height: '200px' }
|
||||
}
|
||||
}"
|
||||
>`,
|
||||
options: `
|
||||
<template>
|
||||
<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>`,
|
||||
composition: `
|
||||
<template>
|
||||
<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>
|
|
@ -0,0 +1,8 @@
|
|||
<template>
|
||||
<DocSectionText v-bind="$attrs">
|
||||
<p>{{ $attrs.description }}</p>
|
||||
</DocSectionText>
|
||||
<div class="card">
|
||||
<img class="w-full" src="https://primefaces.org/cdn/primevue/images/pt/wireframe-placeholder.jpg" />
|
||||
</div>
|
||||
</template>
|
|
@ -0,0 +1,41 @@
|
|||
<template>
|
||||
<div class="doc-main">
|
||||
<div class="doc-intro">
|
||||
<h1>VirtualScroller Pass Through</h1>
|
||||
</div>
|
||||
<DocSections :docs="docs" />
|
||||
</div>
|
||||
<DocSectionNav :docs="docs" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DocApiTable from '@/components/doc/DocApiTable.vue';
|
||||
import { getPTOption } from '@/components/doc/helpers/PTHelper.js';
|
||||
import PtDoc from './PTDoc.vue';
|
||||
import PTImage from './PTImage.vue';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
docs: [
|
||||
{
|
||||
id: 'pt.image',
|
||||
label: 'Wireframe',
|
||||
component: PTImage
|
||||
},
|
||||
{
|
||||
id: 'pt.doc.virtualscroller',
|
||||
label: 'VirtualScroller PT Options',
|
||||
component: DocApiTable,
|
||||
data: getPTOption('VirtualScroller')
|
||||
},
|
||||
{
|
||||
id: 'pt.demo',
|
||||
label: 'Demo',
|
||||
component: PtDoc
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -1,5 +1,12 @@
|
|||
<template>
|
||||
<DocComponent title="Vue Virtual Scroller Component" header="VirtualScroller" description="VirtualScroller is a performant approach to render large amounts of data efficiently." :componentDocs="docs" :apiDocs="['VirtualScroller']" />
|
||||
<DocComponent
|
||||
title="Vue Virtual Scroller Component"
|
||||
header="VirtualScroller"
|
||||
description="VirtualScroller is a performant approach to render large amounts of data efficiently."
|
||||
:componentDocs="docs"
|
||||
:apiDocs="['VirtualScroller']"
|
||||
:ptTabComponent="ptComponent"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -12,6 +19,7 @@ import ImportDoc from '@/doc/virtualscroller/ImportDoc';
|
|||
import LazyDoc from '@/doc/virtualscroller/LazyDoc';
|
||||
import LoadingDoc from '@/doc/virtualscroller/LoadingDoc';
|
||||
import StyleDoc from '@/doc/virtualscroller/StyleDoc';
|
||||
import PTComponent from '@/doc/virtualscroller/pt/index.vue';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
|
@ -62,7 +70,8 @@ export default {
|
|||
label: 'Accessibility',
|
||||
component: AccessibilityDoc
|
||||
}
|
||||
]
|
||||
],
|
||||
ptComponent: PTComponent
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue