Revert "web: 减少重绘"

This reverts commit e12ad9ef4d.
This commit is contained in:
Xwite 2023-05-11 15:11:20 +08:00
parent f9950a7b24
commit 98d878f29d

View File

@ -1,5 +1,8 @@
<template>
<div :class="{ 'cata-wrapper': true, correctSize }" :style="popupTheme">
<div
:class="{ 'cata-wrapper': true, visible: popCataVisible }"
:style="popupTheme"
>
<div class="title">目录</div>
<virtual-list
style="height: 300px; overflow: auto"
@ -74,12 +77,9 @@ const virtualListIndex = computed(() => {
return Math.floor(index.value / 2);
});
const correctSize = ref(false);
watch(popCataVisible, (visible) => {
// virtualListsize0 ResizeObserver
if (visible && !correctSize.value) correctSize.value = true
if (!visible) return;
nextTick(() => virtualListRef.value.scrollToIndex(virtualListIndex.value));
onUpdated(() => {
// domResizeObserversizes Map
virtualListRef.value.scrollToIndex(virtualListIndex.value);
});
</script>