mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 14:53:50 +02:00
improve DataTableLayout scrolling behavior
This commit is contained in:
@@ -37,6 +37,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!fileId) return;
|
||||||
image.value = await getCachedEmoji(fileId);
|
image.value = await getCachedEmoji(fileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="rounded-md border">
|
<div class="rounded-md border">
|
||||||
<div class="max-w-full overflow-auto relative" :style="tableStyle">
|
<div ref="tableScrollRef" class="max-w-full overflow-auto relative" :style="tableStyle">
|
||||||
<Table :class="tableClassValue" :style="tableElementStyle">
|
<Table :class="tableClassValue" :style="tableElementStyle">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col v-for="col in table.getVisibleLeafColumns()" :key="col.id" :style="getColStyle(col)" />
|
<col v-for="col in table.getVisibleLeafColumns()" :key="col.id" :style="getColStyle(col)" />
|
||||||
@@ -116,9 +116,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { computed, nextTick, ref, watch } from 'vue';
|
||||||
import { FlexRender } from '@tanstack/vue-table';
|
import { FlexRender } from '@tanstack/vue-table';
|
||||||
import { Spinner } from '@/components/ui/spinner';
|
import { Spinner } from '@/components/ui/spinner';
|
||||||
import { computed } from 'vue';
|
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { useAppearanceSettingsStore } from '@/stores/';
|
import { useAppearanceSettingsStore } from '@/stores/';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
@@ -185,6 +185,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const tableScrollRef = ref(null);
|
||||||
|
|
||||||
const expandedRenderer = computed(() => {
|
const expandedRenderer = computed(() => {
|
||||||
const columns = props.table.getAllColumns?.() ?? [];
|
const columns = props.table.getAllColumns?.() ?? [];
|
||||||
@@ -319,6 +320,13 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch([currentPage, pageSizeProxy], async () => {
|
||||||
|
await nextTick();
|
||||||
|
if (tableScrollRef.value) {
|
||||||
|
tableScrollRef.value.scrollTop = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const handleRowClick = (row) => {
|
const handleRowClick = (row) => {
|
||||||
if (!props.onRowClick) return;
|
if (!props.onRowClick) return;
|
||||||
props.onRowClick(row);
|
props.onRowClick(row);
|
||||||
|
|||||||
Reference in New Issue
Block a user