findme-miniprogram-frontend/custom-tab-bar/index.wxss

163 lines
4.5 KiB
Text
Raw Permalink Normal View History

2025-12-27 17:16:03 +08:00
/* custom-tab-bar/index.wxss - 自定义底部导航栏样式文件 */
.tab-bar {
position: fixed; /* 固定定位,使导航栏始终显示在屏幕底部 */
bottom: 40rpx; /* 距离屏幕底部20px -> 40rpx */
left: 100rpx; /* 距离屏幕左侧50px -> 100rpx */
right: 100rpx; /* 距离屏幕右侧50px -> 100rpx */
min-height: 200rpx; /* 导航栏最小高度(用户希望保持较大值) */
height: auto; /* 高度自适应内容 */
display: flex; /* 使用flex布局 */
justify-content: space-around; /* 水平均匀分布子元素 */
align-items: center; /* 垂直居中对齐子元素 */
padding: 20rpx; /* 内边距10px -> 20rpx */
box-sizing: border-box; /* 盒模型为border-box宽高包含内边距和边框 */
z-index: 9999; /* 层级设为最高,确保在其他元素之上 */
border-radius: 52rpx; /* 设置圆角,创建胶囊形状 26px -> 52rpx */
}
/* 深灰色玻璃效果 - 继承自app.wxss并增强 */
.tab-bar-glass {
/* 基础玻璃效果 */
background: rgba(30, 30, 30, 0.7); /* 设置半透明深灰色背景透明度0.7 */
backdrop-filter: blur(20rpx); /* 设置背景模糊效果10px -> 20rpx */
-webkit-backdrop-filter: blur(20rpx); /* WebKit内核浏览器兼容设置背景模糊效果 */
/* 添加细微边框增强效果 */
border-top: 2rpx solid rgba(255, 255, 255, 0.1); /* 顶部边框为1px -> 2rpx白色半透明线 */
/* 阴影效果增强层次感 */
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.1); /* 设置底部阴影,增强悬浮感 2px -> 4rpx, 10px -> 20rpx */
}
.tab-bar-item {
flex: 1; /* 让每个按钮占据相同的宽度 */
display: flex; /* 使用flex布局 */
flex-direction: column; /* 垂直方向排列子元素(图标在上,文字在下) */
align-items: center; /* 水平居中对齐子元素 */
justify-content: center; /* 垂直居中对齐子元素 */
height: 100%; /* 高度充满父容器 */
box-sizing: border-box; /* 盒模型为border-box */
}
.tab-bar-icon {
width: 55rpx; /* 图标宽度 */
height: 55rpx; /* 图标高度 */
margin-bottom: 8rpx; /* 与下方文字的间距 */
display: block; /* 显示为块级元素 */
transition: transform 0.3s ease, width 0.3s ease, height 0.3s ease; /* 添加过渡效果 */
}
/* 🔥 所有tab选中时图标放大 */
.tab-bar-icon.tab-icon-active {
width: 80rpx; /* 选中时图标宽度增大 */
height: 80rpx; /* 选中时图标高度增大 */
margin-bottom: 0; /* 选中时没有文字,不需要间距 */
}
/* 拍照按钮索引2未激活时正常大小图标显示文字 */
.camera-icon-normal {
width: 55rpx !important; /* 正常大小 */
height: 55rpx !important; /* 正常大小 */
margin-bottom: 8rpx !important; /* 有文字,需要间距 */
}
/* 拍照按钮索引2激活时大图标不显示文字 */
.camera-icon-large {
width: 80rpx !important; /* 拍照按钮图标更大 */
height: 80rpx !important; /* 拍照按钮图标更大 */
margin-bottom: 0 !important; /* 没有文字,不需要间距 */
}
.tab-bar-text {
font-size: 24rpx; /* 文字大小12px -> 24rpx */
line-height: 24rpx; /* 行高12px -> 24rpx与字体大小一致确保单行显示 */
}
/* 触摸反馈效果 */
.tab-bar-item:active {
opacity: 0.7; /* 触摸时透明度降低到0.7,提供视觉反馈 */
}
/* 拍照功能弹窗样式 */
.camera-action-sheet {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 10000;
transform: none !important;
-webkit-transform: none !important;
}
.camera-action-sheet.show {
display: block;
}
.action-sheet-mask {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
background-color: rgba(0, 0, 0, 0.4);
}
.action-sheet-content {
position: absolute;
bottom: 0;
left: 0;
right: 0;
z-index: 2;
background: #222;
border-radius: 16px 16px 0 0;
padding: 8px 0;
}
.action-sheet-item {
padding: 20px 0;
text-align: center;
background: #222;
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
position: relative;
}
.action-sheet-item::after {
display: none;
}
.action-sheet-item.primary {
background: #222;
}
.action-sheet-item.cancel {
background: #222;
margin-top: 8px;
}
.action-sheet-item.cancel::after {
display: none;
}
.action-sheet-divider {
height: 8px;
background-color: #111;
margin: 8px 0;
}
.action-sheet-divider-thin {
height: 2px;
background-color: #111;
margin: 4px 0;
}
.action-text {
font-size: 16px;
color: #fff;
}