From a817401e89b74073579a99df10738e885fb3b24d Mon Sep 17 00:00:00 2001 From: wanganxp Date: Fri, 21 Jun 2024 06:04:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95web-view=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E9=80=82=E9=85=8Ddark=E4=B8=BB=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hybrid/html/local.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hybrid/html/local.html b/hybrid/html/local.html index fbd12a61..c33516fe 100644 --- a/hybrid/html/local.html +++ b/hybrid/html/local.html @@ -35,6 +35,7 @@ +

网页向应用发送消息。注意:小程序端应用会在此页面后退时接收到消息。

@@ -88,6 +89,9 @@ }) }); break; + /* case 'getTheme': + alert(getThemePreference()) + break; */ default: uni.webView[action]({ url: '/pages/component/button/button' @@ -108,6 +112,15 @@ } }) }) + + /* function getThemePreference() { + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + return 'dark'; + } else if (window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches) { + return 'light'; + } + return 'unknown'; + } */ -- GitLab