This commit is contained in:
lukaijie
2025-08-07 17:31:02 +08:00
2 changed files with 17 additions and 14 deletions

View File

@@ -85,18 +85,28 @@ const SpPage = memo(
useEffect(() => {
if (state.lock) {
// 保存当前滚动位置
const currentScrollTop = scrollTopRef.current || 0
setState((draft) => {
draft.lockStyle = {
position: 'fixed',
top: `-${scrollTopRef.current}px`,
left: '0px',
width: '100%',
bottom: '0px'
overflow: 'hidden'
}
})
// 设置滚动位置,防止回到顶部
setTimeout(() => {
Taro.pageScrollTo({
scrollTop: currentScrollTop,
duration: 0
})
}, 0)
} else {
setState((draft) => {
draft.lockStyle = {}
draft.lockStyle = {
overflow: 'auto'
}
})
}
}, [state.lock])
@@ -260,13 +270,6 @@ const SpPage = memo(
setState((draft) => {
draft.lock = false
})
setTimeout(() => {
Taro.pageScrollTo({
scrollTop: scrollTopRef.current,
duration: 0
})
}, 0)
}
}))
const computedNavigationStyle = () => {

View File

@@ -61,7 +61,7 @@
}
.brand-info {
position: relative;
top: -55px;
top: -70px;
overflow: hidden;
left: 50%;
transform: translateX(-50%);