fix(ui): 首页公告在手机版被撑成 200px 大方块
现象:手机打开首页,公告条变成一个占屏三分之一高的巨型空心块,
文字顶在上方,铃铛图标孤零零飘在左下。
根因:Home.vue 的 carousel 高度样式选择器写得太宽:
:deep(.el-carousel__container) { height: 280px; }
@media (max-width:768px) {
:deep(.el-carousel__container) { height: 200px !important; }
}
`[data-v-xxx] .el-carousel__container` 会匹配首页里**所有** el-carousel,
包括公告轮播。公告轮播组件自己设了 height="32px"(写在容器 inline style 上),
但被那条 !important 规则覆盖 —— 实测 inline 是 height:32px,computed 是 200px。
修复:两条规则都限定到 .banner-section 内,只影响 Banner 轮播。
.banner-section :deep(.el-carousel__container) { height: 280px; }
@media (max-width:768px) {
.banner-section :deep(.el-carousel__container) { height: 200px !important; }
}
This commit is contained in:
@@ -599,7 +599,10 @@ onMounted(async () => {
|
||||
position: relative !important;
|
||||
}
|
||||
|
||||
:deep(.el-carousel__container) {
|
||||
/* 只作用于 Banner 轮播。原来直接写 :deep(.el-carousel__container),
|
||||
会把首页里所有轮播都改成 280px —— 公告轮播组件自己设了 height="32px",
|
||||
被这条规则(以及移动端的 !important 版本)覆盖,结果公告条被撑成 200px 的大块。 */
|
||||
.banner-section :deep(.el-carousel__container) {
|
||||
position: relative !important;
|
||||
height: 280px;
|
||||
}
|
||||
@@ -818,7 +821,8 @@ onMounted(async () => {
|
||||
position: relative !important;
|
||||
}
|
||||
|
||||
:deep(.el-carousel__container) {
|
||||
/* 同上:只作用于 Banner 轮播,别波及公告轮播 */
|
||||
.banner-section :deep(.el-carousel__container) {
|
||||
height: 200px !important;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user