Skip to content

Commit

Permalink
🐛 使Chrome和Edge动画错位的修复仅应用于Android设备
Browse files Browse the repository at this point in the history
  • Loading branch information
Redlnn committed Nov 12, 2024
1 parent 308f991 commit 54eb32a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/.vitepress/theme/Layout.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<script setup lang="ts">
import DefaultTheme from 'vitepress/theme-without-fonts'
import { useData } from 'vitepress'
import { useElementSize } from '@vueuse/core'
import { nextTick, provide, ref } from 'vue'
import { useElementSize, useWindowSize } from '@vueuse/core'
const getStatusBarHeightRef = ref<HTMLDivElement>()
const { height: windowHeight } = useWindowSize()
const { height: viewHeight } = useElementSize(getStatusBarHeightRef)
const { isDark } = useData()
Expand All @@ -21,7 +20,9 @@ provide('toggle-appearance', async ({ clientX: x, clientY: y }: MouseEvent) => {
}
// 用于计算状态栏高度,不加的话在 Android 端 Chrome 和 Edge 动画会错位,Via 浏览器和 PC 端无影响
const statusBarHeight = viewHeight.value - windowHeight.value
const statusBarHeight = navigator.userAgent.includes('Android')
? viewHeight.value - innerHeight
: 0
const clipPath = [
`circle(0px at ${x}px ${y + statusBarHeight}px)`,
Expand Down

0 comments on commit 54eb32a

Please sign in to comment.