-
Notifications
You must be signed in to change notification settings - Fork 21
fix: prevent skeleton layout shift during pagination #425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
| rowHeights.value = rowRefs.value.map((el: HTMLElement) => el.offsetHeight); | ||
| } | ||
| if (headerRefs.value) { | ||
| // 48 - это примерная ширина чекбокса, если он есть |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment
| const headerRefs = useTemplateRef<HTMLElement[]>('headerRefs'); | ||
| const rowHeights = ref<number[]>([]); | ||
| const columnWidths = ref<number[]>([]); | ||
| const checkboxHeaderRef = useTemplateRef<HTMLElement>('checkboxHeaderRef'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const columnWidth = 48
| if (rowRefs.value) rowHeights.value = rowRefs.value.map((el: HTMLElement) => el.offsetHeight); | ||
| if (headerRefs.value) columnWidths.value = [48, ...headerRefs.value.map((el: HTMLElement) => el.offsetWidth)]; | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
watch(() => props.rows, async (newRows) => {
// rows are set to null when new records are loading
rowHeights.value = newRows || !rowRefs.value ? [] : rowRefs.value.map((el: HTMLElement) => el.offsetHeight);
columnWidths.value = newRows || !headerRefs.value ? [] : [48, ...headerRefs.value.map((el: HTMLElement) => el.offsetWidth)];
if (!newRows) return;
await nextTick();
if (rowRefs.value) {
rowHeights.value = rowRefs.value.map((el: HTMLElement) => el.offsetHeight);
}
if (headerRefs.value) {
columnWidths.value = [48, ...headerRefs.value.map((el: HTMLElement) => el.offsetWidth)];
}
});
No description provided.