Skip to content

fix(mobile): 修复移动端歌词混合模式和滚动行为#1059

Open
MoYingJi wants to merge 3 commits intoimsyy:devfrom
MoYingJi:pr/fix/mobile
Open

fix(mobile): 修复移动端歌词混合模式和滚动行为#1059
MoYingJi wants to merge 3 commits intoimsyy:devfrom
MoYingJi:pr/fix/mobile

Conversation

@MoYingJi
Copy link
Copy Markdown
Collaborator

详情可以看每个 commit

有 99% 的是 AI 写的(

横纵向滑动会同时进行,如我想横向滑动切换到主页面却滑动了歌词,我想纵向滑动歌词却进行了横向滑动,导致体验不佳

神奇的 AI 改的,我也不懂喵(
Copilot AI review requested due to automatic review settings April 30, 2026 15:39
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the useSwipe hook with a custom touch handling implementation to support axis locking, ensuring horizontal page switching does not conflict with vertical scrolling. It also moves the lyric component to a separate overlay to resolve mix-blend-mode issues caused by the transform stacking context. Key feedback includes ensuring touchmove listeners are not passive to allow event prevention, managing pointer-events on the new overlay to avoid blocking underlying UI elements, providing full touch data when dispatching touchcancel, and using preventDefault on touchend to avoid ghost clicks.

Comment on lines +5 to +7
@touchstart.capture="onTouchStart"
@touchmove.capture="onTouchMove"
@touchend.capture="onTouchEnd"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

在现代移动端浏览器中,touchmove 事件监听器默认通常是 passive 的,这会导致在 onTouchMove 中调用 e.preventDefault() 失效并触发控制台警告。由于 Vue 模板目前没有直接支持非 passive 监听器的修饰符,建议在 onMounted 生命周期钩子中通过 addEventListener(..., { capture: true, passive: false }) 手动绑定这些事件,以确保能够正确拦截滚动。

Comment on lines +616 to +630
.lyric-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
// 顶部留出 lyric-page padding-top(60px) + lyric-header 高度(约 80px)
padding: 140px 24px 0;
box-sizing: border-box;
mix-blend-mode: var(--lyric-blend-mode);
transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
&.swiping {
transition: none;
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

lyric-overlay 作为一个覆盖在整个播放器上方的绝对定位层,其 padding-top 区域虽然在视觉上是透明的,但默认仍会拦截触摸事件。这会导致位于其下方的 lyric-header 中的操作按钮(如喜欢按钮)无法被点击。建议为 .lyric-overlay 设置 pointer-events: none,并为其内部内容恢复点击事件。

  .lyric-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    // 顶部留出 lyric-page padding-top(60px) + lyric-header 高度(约 80px)
    padding: 140px 24px 0;
    box-sizing: border-box;
    mix-blend-mode: var(--lyric-blend-mode);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    pointer-events: none;
    & > * {
      pointer-events: auto;
    }
    &.swiping {
      transition: none;
    }
  }

Comment thread src/components/Player/FullPlayerMobile.vue
Comment thread src/components/Player/FullPlayerMobile.vue Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 针对移动端全屏播放器的歌词页做了交互与渲染层级调整,主要解决歌词 mix-blend-modetransform 形成的 stacking context 阻断,以及歌词页横向翻页与纵向滚动手势冲突的问题。

Changes:

  • 将歌词组件从 mobile-content 内抽离为独立的覆盖层(lyric-overlay),以避免 transform 阻断混合模式效果
  • 用自定义 touch 轴锁定逻辑替换 @vueuse/coreuseSwipe,区分横向翻页与纵向滚动
  • 调整滑动状态类名与 transform 计算,使歌词覆盖层与页面滑动视觉同步

Comment thread src/components/Player/FullPlayerMobile.vue Outdated
Comment thread src/components/Player/FullPlayerMobile.vue
ref="mobileStart"
@touchstart.capture="onTouchStart"
@touchmove.capture="onTouchMove"
@touchend.capture="onTouchEnd"
Comment on lines +251 to +254
// 确认是水平滑动时,在捕获阶段下发 touchcancel 终止子组件(如AMLL)内部的滑动状态
if (axisLock.value === "x" && e.target instanceof EventTarget) {
e.target.dispatchEvent(new TouchEvent("touchcancel", { bubbles: true, cancelable: true }));
}
Comment thread src/components/Player/FullPlayerMobile.vue Outdated
@MoYingJi MoYingJi force-pushed the pr/fix/mobile branch 2 times, most recently from 80dfb55 to 2284b39 Compare April 30, 2026 16:04
@MoYingJi MoYingJi force-pushed the pr/fix/mobile branch 3 times, most recently from 590e69b to 5a0476c Compare April 30, 2026 16:39
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.

2 participants