更新记录
1.0.3(2025-04-08)
增小程序相关逻辑
1.0.2(2025-03-18)
调整插件名称
平台兼容性
uni-app x
| Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
|---|---|---|---|---|---|
| - | - | 5.0 | 12 | √ | - |
uni-getdeviceid
使用文档
在main.js文件增加下方代码
import {getDeviceId,getDeviceIdSync} from "@/uni_modules/uu-getdeviceid";
uni.getDeviceId = getDeviceId;
uni.getDeviceIdSync = getDeviceIdSync;
可实现uni.getDeviceIdSync()或者uni.getDeviceId()方法调用方法
// 获取设备ID(同步)
let {
deviceId
} = uni.getDeviceIdSync();
// 获取设备ID(异步)
uni.getDeviceId({
success(res) {
console.log(res);
uni.showToast({
title: "设备ID:" + res.deviceId,
icon: 'none'
});
}
})
参数
Object object
| 属性 | 类型 | 必填 | 说明 |
|---|---|---|---|
| success | function | 否 | 接口调用成功的回调函数 |
| fail | function | 否 | 接口调用失败的回调函数 |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
object.success 回调函数
| 属性 | 类型 | 说明 |
|---|---|---|
| deviceId | string | 设备Id |
HarmonyOS next权限配置
{
"name": "ohos.permission.STORE_PERSISTENT_DATA",
"usedScene": {
"abilities": [
"EntryAbility"
],
"when": "always"
},
}

收藏人数:
购买源码授权版(
试用
赞赏(0)
下载 6
赞赏 0
下载 11002810
赞赏 1800
赞赏
京公网安备:11010802035340号