更新依赖版本,优化组件逻辑

This commit is contained in:
lyswhut
2025-08-09 18:07:16 +08:00
parent 8a8c8a5699
commit ffa979ddc8
5 changed files with 31 additions and 15 deletions
@@ -270,9 +270,15 @@ export default {
cachedList = Array(list.length)
startIndex = -1
endIndex = -1
void nextTick(() => {
updateView()
})
if (cachedList.length) {
void nextTick(() => {
requestAnimationFrame(() => {
updateView()
})
})
} else {
views.value = []
}
}
watch(() => props.itemHeight, () => {
handleReset(props.list)
@@ -289,7 +295,15 @@ export default {
cachedList = Array(props.list.length)
startIndex = -1
endIndex = -1
updateView()
if (props.list.length) {
void nextTick(() => {
requestAnimationFrame(() => {
console.log('updateView')
updateView()
})
})
}
window.addEventListener('resize', handleResize)
})
onBeforeUnmount(() => {