1***@qq.com
1***@qq.com
  • 发布:2025-08-01 10:58
  • 更新:2025-11-05 16:04
  • 阅读:318

一键登录如何适配鸿蒙系统

分类:uni-app

async preLogin({ commit }) {
console.log("预登录");
try {
const univerifyManager = uni.getUniverifyManager();
const res = await univerifyManager.preLogin();
// 处理返回值为数组的情况
const result = JSON.stringify(res);
if (result?.includes("ok")) {
console.log("预登录成功", res);
commit("setOneLoginBottom", true);
} else {
console.log("预登录失败>>>>>>", res);
commit("setOneLogin", true);
commit("setOneLoginBottom", false);
}
} catch (e) {
console.log("预登录失败 --- ", e);
commit("setOneLogin", true);
commit("setOneLoginBottom", false);
}
}

好像预登录不上 打印输出10:46:51.142 预登录失败>>>>>>, undefined at store/module/app.js:29
但是用uni.preLogin() 是成功的

2025-08-01 10:58 负责人:无 分享
已邀请:
DCloud_UNI_LXH

DCloud_UNI_LXH

鸿蒙不支持 uni.preLogin 调用。univerifyManager.preLogin 也没有返回值,不返回 Promise,需要传 options,success、fail 回调

  • 3***@qq.com

    那用什么办法解决 鸿蒙登录不上

    2025-09-24 21:47

  • DCloud_UNI_LXH

    回复 3***@qq.com: 使用 univerifyManager ,preLogin 后再 login

    2025-09-25 10:48

h***@163.com

h***@163.com

你好,鸿蒙接入一键登录,必须得是vue3吗,现有vue2的项目想支持鸿蒙一键登录是不是不行?

2***@qq.com

2***@qq.com - 这人很懒

一键登录早就适配鸿蒙了的

要回复问题请先登录注册