fix: Improve mobile layout and scrolling behavior

This commit is contained in:
1808837298@qq.com
2025-03-11 15:05:23 +08:00
parent bbe7223a85
commit 3122b8a36a
3 changed files with 25 additions and 9 deletions

View File

@@ -61,7 +61,7 @@ const FooterBar = () => {
return ( return (
<div style={{ <div style={{
textAlign: 'center', textAlign: 'center',
paddingBottom: styleState?.isMobile ? '112px' : '5px', paddingBottom: '5px',
}}> }}>
{footer ? ( {footer ? (
<div <div

View File

@@ -75,13 +75,13 @@ const PageLayout = () => {
height: '100vh', height: '100vh',
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
overflow: 'hidden' overflow: styleState.isMobile ? 'visible' : 'hidden'
}}> }}>
<Header style={{ <Header style={{
padding: 0, padding: 0,
height: 'auto', height: 'auto',
lineHeight: 'normal', lineHeight: 'normal',
position: 'fixed', position: styleState.isMobile ? 'sticky' : 'fixed',
width: '100%', width: '100%',
top: 0, top: 0,
zIndex: 100, zIndex: 100,
@@ -90,9 +90,9 @@ const PageLayout = () => {
<HeaderBar /> <HeaderBar />
</Header> </Header>
<Layout style={{ <Layout style={{
marginTop: '56px', marginTop: styleState.isMobile ? '0' : '56px',
height: 'calc(100vh - 56px)', height: styleState.isMobile ? 'auto' : 'calc(100vh - 56px)',
overflow: 'auto', overflow: styleState.isMobile ? 'visible' : 'auto',
display: 'flex', display: 'flex',
flexDirection: 'column' flexDirection: 'column'
}}> }}>
@@ -121,10 +121,11 @@ const PageLayout = () => {
<Content <Content
style={{ style={{
flex: '1 0 auto', flex: '1 0 auto',
overflowY: 'auto', overflowY: styleState.isMobile ? 'visible' : 'auto',
WebkitOverflowScrolling: 'touch', WebkitOverflowScrolling: 'touch',
padding: styleState.shouldInnerPadding? '24px': '0', padding: styleState.shouldInnerPadding? '24px': '0',
position: 'relative', position: 'relative',
marginTop: styleState.isMobile ? '2px' : '0',
}} }}
> >
<App /> <App />

View File

@@ -1,7 +1,6 @@
body { body {
margin: 0; margin: 0;
padding-top: 0; padding-top: 0;
overflow: hidden;
font-family: Lato, 'Helvetica Neue', Arial, Helvetica, 'Microsoft YaHei', font-family: Lato, 'Helvetica Neue', Arial, Helvetica, 'Microsoft YaHei',
sans-serif; sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
@@ -13,7 +12,8 @@ body {
} }
#root { #root {
height: 100vh; height: 100%;
display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
} }
@@ -86,8 +86,23 @@ body {
/* 确保移动端内容可滚动 */ /* 确保移动端内容可滚动 */
.semi-layout-content { .semi-layout-content {
-webkit-overflow-scrolling: touch !important; -webkit-overflow-scrolling: touch !important;
overscroll-behavior-y: auto !important;
} }
/* 修复移动端下拉刷新 */
body {
overflow: visible !important;
overscroll-behavior-y: auto !important;
position: static !important;
height: 100% !important;
}
/* 确保内容区域在移动端可以正常滚动 */
#root {
overflow: visible !important;
height: 100% !important;
}
/* 隐藏在移动设备上 */ /* 隐藏在移动设备上 */
.hide-on-mobile { .hide-on-mobile {
display: none !important; display: none !important;