Skip to content

Commit

Permalink
feat(uni-app-x web): 补充getDeviceInfo缺失的属性
Browse files Browse the repository at this point in the history
  • Loading branch information
Wangyaqi committed May 18, 2024
1 parent 25dba6f commit 7ea7d03
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions packages/uni-h5/src/service/api/device/getSystemInfoSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,32 @@ export const getDeviceInfo = defineSyncApi<typeof uni.getDeviceInfo>(
system,
deviceOrientation,
deviceType,
osname,
osversion,
} = browserInfo

return {
brand,
deviceBrand,
deviceModel,
devicePixelRatio: __NODE_JS__ ? 1 : window.devicePixelRatio,
deviceId: __NODE_JS__
? Date.now() + '' + Math.floor(Math.random() * 1e7)
: deviceId(),
deviceOrientation,
deviceType,
model,
platform,
system,
}
return extend(
{
brand,
deviceBrand,
deviceModel,
devicePixelRatio: __NODE_JS__ ? 1 : window.devicePixelRatio,
deviceId: __NODE_JS__
? Date.now() + '' + Math.floor(Math.random() * 1e7)
: deviceId(),
deviceOrientation,
deviceType,
model,
platform,
system,
},
__X__
? {
osName: osname ? osname.toLocaleLowerCase() : undefined,
osVersion: osversion,
}
: {}
)
}
)
export const getAppBaseInfo = defineSyncApi<typeof uni.getAppBaseInfo>(
Expand Down

0 comments on commit 7ea7d03

Please sign in to comment.