From b171bd37bd79945e562f0a7262eef64637b5108d Mon Sep 17 00:00:00 2001 From: DCloud_LXH <283700113@qq.com> Date: Fri, 27 May 2022 16:38:56 +0800 Subject: [PATCH] fix: ssr window is undefined --- packages/uni-h5/src/service/api/device/getSystemInfoSync.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/uni-h5/src/service/api/device/getSystemInfoSync.ts b/packages/uni-h5/src/service/api/device/getSystemInfoSync.ts index 612863157..c779f3b9b 100644 --- a/packages/uni-h5/src/service/api/device/getSystemInfoSync.ts +++ b/packages/uni-h5/src/service/api/device/getSystemInfoSync.ts @@ -36,7 +36,9 @@ export const getDeviceInfo = defineSyncApi( deviceBrand, deviceModel, devicePixelRatio: __NODE_JS__ ? 1 : window.devicePixelRatio, - deviceId: deviceId(), + deviceId: __NODE_JS__ + ? Date.now() + '' + Math.floor(Math.random() * 1e7) + : deviceId(), deviceOrientation, deviceType, brand, -- GitLab