提交 d6787d5d 编写于 作者: D DCloud_LXH

chore: darkmode

上级 8e608a6d
...@@ -2,17 +2,19 @@ ...@@ -2,17 +2,19 @@
### uni.onThemeChange(CALLBACK) ### uni.onThemeChange(CALLBACK)
监听系统主题状态变化。 监听系统主题状态变化。
> 相关文档:[DarkMode 适配指南](https://uniapp.dcloud.net.cn/tutorial/darkmode.html)
**平台差异说明** **平台差异说明**
|App|H5|微信小程序|支付宝小程序|百度小程序|字节跳动小程序|飞书小程序|QQ小程序|快手小程序|京东小程序| |App|H5|微信小程序|支付宝小程序|百度小程序|字节跳动小程序|飞书小程序|QQ小程序|快手小程序|京东小程序|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:| |:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|√|√|基础库 2.11.0+|x|x|x|V5.3.0+|x|x|x| |`iOS HBuilderX 2.6.5+``Android HBuilderX 3.6.9+`|HBuilderX 3.6.9+|基础库 2.11.0+|x|x|x|V5.3.0+|x|x|x|
**CALLBACK 返回参数** **CALLBACK 返回参数**
|参数|类型|说明|平台差异说明| |参数|类型|说明|
|:-|:-|:-|:-| |:-|:-|:-|:-|
|theme|String|主题名称(dark, light)|App2.6.5+ 仅iOS| |theme|String|主题名称(dark, light)|
**示例** **示例**
...@@ -38,9 +40,11 @@ uni.onThemeChange(function (res) { ...@@ -38,9 +40,11 @@ uni.onThemeChange(function (res) {
**示例** **示例**
```javascript ```javascript
uni.onThemeChange(function (res) { const callback = function (res) {
console.log(res.theme); console.log(res.theme);
}); }
uni.onThemeChange(callback);
uni.offThemeChange(callback);
``` ```
**注意** **注意**
......
## 深色模式适配 ## DarkMode 适配指南
> HBuilder X 3.6.9+ 支持 > HBuilder X 3.6.9+ 支持
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册