Skip to content

fix(song): 手机端播放器塌成一条(判定盘高度为 0) - #94

Merged
LingFeng-bbben merged 1 commit into
mainfrom
fix/song-mobile-layout
Nov 25, 2026
Merged

LingFeng-bbben merged 1 commit into
mainfrom
fix/song-mobile-layout

Conversation

@LingFeng-bbben

Copy link
Copy Markdown
Contributor

现象

手机竖屏打开 /song 时播放器只有 58px 高,判定盘 0×0,只剩一条进度条:

判定盘尺寸
修复前 390 × 0
修复后 390 × 390

原因

之前给 .majview-stage 加了 container-type: size(让判定盘按容器短边取正方形),它会带上 size containment —— 元素高度不再由内容撑开。桌面端 stage 的高度由 flex 给定所以没问题;手机端 .song-stage 的 aspect-ratio 被关掉、.majview 又是 height: auto,整条链就塌成 0。

改法

只在 @media (max-width: 48rem) 里:

.song-stage .majview-stage { container-type: normal; }
.song-stage .majview-scene { width: 100%; height: auto; aspect-ratio: 1; }

宽度撑满、高度按正方形算,不再依赖容器高度。

验证

视口 判定盘 控制条
390×844 390×390 390×58 接在下面
360×640 360×360 不横向溢出
768×1024 768×768 58px
844×390(横屏) 218×218 居中(桌面布局) 62px

页面无横向溢出,谱面 0/746 正常加载;tsc / eslint / vitest(461 passed)/ build 全 0。

竖屏手机打开 /song 时播放器只有 58px 高、判定盘 0×0,只剩一条进度条。

原因是之前给 .majview-stage 加了 container-type: size(为了让判定盘按容器短边
取正方形),它会带上 size containment —— 元素高度不再由内容撑开。桌面端 stage
的高度由 flex 给定,没事;手机端 .song-stage 的 aspect-ratio 被关掉、
.majview 又是 height: auto,整条链就只能塌到 0。

改法(只在 ≤48rem 的媒体查询里):
- .majview-stage { container-type: normal }:不再依赖容器高度;
- .majview-scene { width: 100%; height: auto; aspect-ratio: 1 }:让宽度决定高度。

验证:390×844 判定盘 390×390、控制条 58px 接在下面;
360×640 判定盘 360×360、控制条不横向溢出;
768×1024 判定盘 768×768;844×390 横屏仍走桌面布局(判定盘 218×218 居中)。
@LingFeng-bbben
LingFeng-bbben merged commit 7ebba2e into main Nov 25, 2026
2 checks passed
@LingFeng-bbben
LingFeng-bbben deleted the fix/song-mobile-layout branch November 25, 2026 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant