From ce6d490abbbc5b83b47a282865b878f3ba232744 Mon Sep 17 00:00:00 2001 From: He Hang Date: Fri, 10 Nov 2023 21:26:26 +0800 Subject: [PATCH] b --- web/src/App.vue | 4 ++-- web/src/style/base.less | 7 ------- web/src/utils/utils.ts | 13 ++++++------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/web/src/App.vue b/web/src/App.vue index ea00c4c..b1cb50f 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -6,7 +6,7 @@ import Footer from './components/Footer.vue'; import CurrentList from './components/CurrentList.vue'; import PlayDetail from './components/PlayDetail.vue'; import WindowHelper from './components/WindowHelper.vue'; -import { fixIos15IPhone8Height, webView2Services } from './utils/utils'; +import { fixNotchIPhoneHeight, webView2Services } from './utils/utils'; import { MusicConnection } from './stores/connection'; import { usePlayStore } from './stores/play'; import { useSettingStore } from './stores/setting'; @@ -29,7 +29,7 @@ iconLink.rel = 'icon'; iconLink.href = LogoCircleImage; document.head.appendChild(iconLink); new MusicConnection(webView2Services.enabled); -fixIos15IPhone8Height(); +fixNotchIPhoneHeight(); let rootClass = webView2Services.enabled ? 'webview-host' : ''; diff --git a/web/src/style/base.less b/web/src/style/base.less index 0de1093..8cf66ce 100644 --- a/web/src/style/base.less +++ b/web/src/style/base.less @@ -135,13 +135,6 @@ body, padding: 0; } -@media (display-mode: standalone) { - html { - height: 100vh; - width: 100vw; - } -} - body { color: var(--music-text-color); transition: color 0.5s; diff --git a/web/src/utils/utils.ts b/web/src/utils/utils.ts index fe6da37..b6f1442 100644 --- a/web/src/utils/utils.ts +++ b/web/src/utils/utils.ts @@ -99,12 +99,12 @@ export function getRandomInt(min: number, max: number, ignore?: number) { } } -export function fixIos15IPhone8Height() { +export function fixNotchIPhoneHeight() { const computeStyle = getComputedStyle(document.documentElement); - const sat = computeStyle.getPropertyValue('--sat') || ''; - const sal = computeStyle.getPropertyValue('--sal') || ''; - const sar = computeStyle.getPropertyValue('--sar') || ''; - const sab = computeStyle.getPropertyValue('--sab') || ''; + const sat = computeStyle.getPropertyValue('--sat') || '0'; + const sal = computeStyle.getPropertyValue('--sal') || '0'; + const sar = computeStyle.getPropertyValue('--sar') || '0'; + const sab = computeStyle.getPropertyValue('--sab') || '0'; alert(`哈哈哈哈 ${sat}-${sal}-${sar}-${sab}`); if (!isInStandaloneMode || !isIOS) return; alert(`哈哈哈哈 1`); @@ -118,8 +118,7 @@ export function fixIos15IPhone8Height() { !sar.startsWith('0') || !sab.startsWith('0') ) - return; - document.body.parentElement!.style.height = '100%'; + document.body.parentElement!.style.height = '100vh'; } export function duration2Millisecond(duration: string) {