wx.getSystemSetting
Object wx.getSystemSetting()
基础库 2.20.1 开始支持,低版本需做兼容处理。
小程序插件:支持,需要小程序基础库版本不低于 2.21.3
微信 Windows 版:支持
微信 Mac 版:支持
微信 鸿蒙 OS 版:支持
功能描述
获取设备设置
返回值
Object
| 属性 | 类型 | 说明 | |
|---|---|---|---|
| bluetoothEnabled | boolean | 蓝牙的系统开关 | |
| locationEnabled | boolean | 地理位置的系统开关 | |
| wifiEnabled | boolean | Wi-Fi 的系统开关 | |
| deviceOrientation | string | 设备方向(注意:IOS客户端横屏游戏获取deviceOrientation可能不准,建议以屏幕宽高为准) | |
| 合法值说明portrait竖屏landscape横屏 |
示例代码
const systemSetting = wx.getSystemSetting()
console.log(systemSetting.bluetoothEnabled)
console.log(systemSetting.deviceOrientation)
console.log(systemSetting.locationEnabled)
console.log(systemSetting.wifiEnabled)
浙公网安备 33010602011771号