feat: quick switcher

This commit is contained in:
Zoe
2026-02-26 14:51:47 -06:00
parent 97afa1cbe1
commit bf9f613e4d
6 changed files with 201 additions and 7 deletions
+7 -1
View File
@@ -25,13 +25,19 @@ const rowVirtualizer = useVirtualizer(computed(() => ({
const virtualRows = computed(() => rowVirtualizer.value.getVirtualItems());
const totalSize = computed(() => rowVirtualizer.value.getTotalSize());
defineExpose({
scrollToIndex: (index: number, options?: { align?: 'start' | 'center' | 'end' }) => {
rowVirtualizer.value.scrollToIndex(index, options);
}
})
watch(() => props.items, () => {
rowVirtualizer.value.measure();
}, { deep: false });
</script>
<template>
<div :style="{ height: `${totalSize}px`, width: '100%', position: 'relative' }">
<div :style="{ height: `${totalSize}px`, width: '100%', position: 'relative' }" v-bind="$attrs">
<div v-for="virtualRow in virtualRows" :key="(virtualRow.key as any | number)" :style="{
position: 'absolute',
top: 0,