Taro.getSystemSetting()
获取设备设置
支持情况:

H5: 不支持 bluetoothEnabled、locationEnabled、wifiEnabled
类型
() => Result
参数
Result
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| bluetoothEnabled | boolean | 否 | 蓝牙的系统开关 |
| locationEnabled | boolean | 否 | 地理位置的系统开关 |
| wifiEnabled | boolean | 否 | Wi-Fi 的系统开关 |
| deviceOrientation | keyof DeviceOrientation | 否 | 设备方向 |
DeviceOrientation
设备方向合法值
| 参数 | 说明 |
|---|---|
| portrait | 竖屏 |
| landscape | 横屏 |
示例代码
const systemSetting = Taro.getSystemSetting()
console.log(systemSetting.bluetoothEnabled)
console.log(systemSetting.deviceOrientation)
console.log(systemSetting.locationEnabled)
console.log(systemSetting.wifiEnabled)