upload project
This commit is contained in:
commit
06961cae04
422 changed files with 110626 additions and 0 deletions
222
styles/screen-adaption.wxss
Normal file
222
styles/screen-adaption.wxss
Normal file
|
|
@ -0,0 +1,222 @@
|
|||
/* 小程序屏幕适配通用样式 - 解决滚动条问题 */
|
||||
/* 基于最新的微信小程序最佳实践 */
|
||||
|
||||
/* 全局页面样式 - 禁用滚动 */
|
||||
page {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 通用页面容器 - 全屏高度适配 */
|
||||
.page-container {
|
||||
height: 100vh;
|
||||
min-height: 100vh;
|
||||
max-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* 适配安全区域 */
|
||||
.safe-area-container {
|
||||
height: 100vh;
|
||||
padding-top: env(safe-area-inset-top);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
padding-left: env(safe-area-inset-left);
|
||||
padding-right: env(safe-area-inset-right);
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 内容区域 - 可滚动 */
|
||||
.scrollable-content {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 固定头部 */
|
||||
.fixed-header {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1000;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* 固定底部 */
|
||||
.fixed-footer {
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
z-index: 1000;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* 适配不同屏幕尺寸的媒体查询 */
|
||||
/* iPhone SE (375x667) */
|
||||
@media screen and (max-width: 375px) {
|
||||
.page-container {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
|
||||
/* iPhone 12/13/14 (390x844) */
|
||||
@media screen and (max-width: 390px) and (min-height: 844px) {
|
||||
.page-container {
|
||||
height: 100vh;
|
||||
}
|
||||
}
|
||||
|
||||
/* iPhone 12/13/14 Pro Max (428x926) */
|
||||
@media screen and (max-width: 428px) and (min-height: 926px) {
|
||||
.page-container {
|
||||
height: 100vh;
|
||||
}
|
||||
}
|
||||
|
||||
/* iPad适配 */
|
||||
@media screen and (min-width: 768px) {
|
||||
.page-container {
|
||||
max-width: 750rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
|
||||
/* 禁用选择和长按 */
|
||||
.no-select {
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
-webkit-touch-callout: none;
|
||||
}
|
||||
|
||||
/* 防止点击穿透 */
|
||||
.prevent-touch {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.allow-touch {
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
/* 通用动画 */
|
||||
.fade-in {
|
||||
animation: fadeIn 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.slide-up {
|
||||
animation: slideUp 0.3s ease-out;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes slideUp {
|
||||
from {
|
||||
transform: translateY(20rpx);
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* 响应式字体大小 */
|
||||
.responsive-text {
|
||||
font-size: clamp(24rpx, 2.5vw, 32rpx);
|
||||
}
|
||||
|
||||
.responsive-title {
|
||||
font-size: clamp(32rpx, 4vw, 48rpx);
|
||||
}
|
||||
|
||||
.responsive-subtitle {
|
||||
font-size: clamp(26rpx, 3vw, 36rpx);
|
||||
}
|
||||
|
||||
/* 通用间距 */
|
||||
.spacing-xs { margin: 8rpx; }
|
||||
.spacing-sm { margin: 16rpx; }
|
||||
.spacing-md { margin: 24rpx; }
|
||||
.spacing-lg { margin: 32rpx; }
|
||||
.spacing-xl { margin: 48rpx; }
|
||||
|
||||
.padding-xs { padding: 8rpx; }
|
||||
.padding-sm { padding: 16rpx; }
|
||||
.padding-md { padding: 24rpx; }
|
||||
.padding-lg { padding: 32rpx; }
|
||||
.padding-xl { padding: 48rpx; }
|
||||
|
||||
/* Flexbox布局助手 */
|
||||
.flex-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.flex-between {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.flex-column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.flex-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.flex-1 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.flex-shrink-0 {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* 通用圆角 */
|
||||
.rounded-sm { border-radius: 8rpx; }
|
||||
.rounded-md { border-radius: 16rpx; }
|
||||
.rounded-lg { border-radius: 24rpx; }
|
||||
.rounded-xl { border-radius: 32rpx; }
|
||||
.rounded-full { border-radius: 50%; }
|
||||
|
||||
/* 通用阴影 */
|
||||
.shadow-sm {
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.shadow-md {
|
||||
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.shadow-lg {
|
||||
box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
/* 调试模式 - 开发时使用 */
|
||||
.debug-border {
|
||||
border: 2rpx solid red !important;
|
||||
}
|
||||
|
||||
.debug-bg {
|
||||
background: rgba(255, 0, 0, 0.1) !important;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue