perf(listings): 优化从详情页返回首页的滚动恢复体验,消除顶部闪跳
This commit is contained in:
@@ -368,13 +368,6 @@ function restoreScrollPosition() {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const restoredList = restoreFromCache()
|
||||
if (!restoredList) {
|
||||
loadListings()
|
||||
}
|
||||
if (!restoreHomeConfigFromCache()) {
|
||||
loadHomeConfig()
|
||||
}
|
||||
if (restoredList) {
|
||||
restoreScrollPosition()
|
||||
}
|
||||
@@ -811,6 +804,15 @@ function getItemResourcePreview(item: Listing) {
|
||||
}
|
||||
|
||||
syncMobileHomeQuery()
|
||||
|
||||
// 同步恢复列表和配置快照,确保首帧 DOM 即包含完整卡片列表,避免高度塌陷和滚动闪跳
|
||||
const restoredList = restoreFromCache()
|
||||
if (!restoredList) {
|
||||
loadListings()
|
||||
}
|
||||
if (!restoreHomeConfigFromCache()) {
|
||||
loadHomeConfig()
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user