提交 a817401e 编写于 作者: W wanganxp

测试web-view是否适配dark主题

上级 5a366711
......@@ -35,6 +35,7 @@
<button class="btn" type="button" data-action="reLaunch">reLaunch</button>
<button class="btn" type="button" data-action="switchTab">switchTab</button>
<button class="btn" type="button" data-action="getEnv">getEnv</button>
<!-- <button class="btn" type="button" data-action="getTheme">获取主题</button> -->
</div>
<p class="desc">网页向应用发送消息。注意:小程序端应用会在此页面后退时接收到消息。</p>
<div class="btn-list">
......@@ -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';
} */
</script>
</body>
</html>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册