Refactor #3832 Refactor #3833 - For VirtualScroller

pull/3853/head
Tuğçe Küçükoğlu 2023-04-07 09:50:09 +03:00
parent 20726d35e1
commit 8a1a8e8214
3 changed files with 18 additions and 4 deletions

View File

@ -153,15 +153,19 @@ const VirtualScrollerEvents = [
const VirtualScrollerSlots = [ const VirtualScrollerSlots = [
{ {
name: 'item', name: 'item',
description: 'Content for the item' description: 'Content for the item.'
}, },
{ {
name: 'content', name: 'content',
description: 'Custom content for the component' description: 'Custom content for the component.'
}, },
{ {
name: 'loader', name: 'loader',
description: 'Custom content for the loader items' description: 'Custom content for the loader items.'
},
{
name: 'loadingicon',
description: 'Custom loading icon template.'
} }
]; ];

View File

@ -308,6 +308,10 @@ export interface VirtualScrollerSlots {
*/ */
options: VirtualScrollerLoaderOptions; options: VirtualScrollerLoaderOptions;
}): VNode[]; }): VNode[];
/**
* Custom loading icon template.
*/
loadingicon(): VNode[];
} }
/** /**

View File

@ -31,7 +31,9 @@
<slot name="loader" :options="getLoaderOptions(index, isBoth() && { numCols: d_numItemsInViewport.cols })"></slot> <slot name="loader" :options="getLoaderOptions(index, isBoth() && { numCols: d_numItemsInViewport.cols })"></slot>
</template> </template>
</template> </template>
<i v-else class="p-virtualscroller-loading-icon pi pi-spinner pi-spin"></i> <slot name="loadingicon">
<SpinnerIcon spin class="p-virtualscroller-loading-icon" />
</slot>
</div> </div>
</div> </div>
</template> </template>
@ -42,6 +44,7 @@
</template> </template>
<script> <script>
import SpinnerIcon from 'primevue/icon/spinner';
import { DomHandler } from 'primevue/utils'; import { DomHandler } from 'primevue/utils';
export default { export default {
@ -742,6 +745,9 @@ export default {
return this.columns; return this.columns;
} }
},
components: {
SpinnerIcon: SpinnerIcon
} }
}; };
</script> </script>