xiaoe_mp_npm 0.5.42-alpha7 → 0.5.42-alpha8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -58,13 +58,13 @@ export const isPhone = (val) => {
|
|
|
58
58
|
// 大屏适配 rpx 转 vmin
|
|
59
59
|
export const rpxToVmin = (rpx) => {
|
|
60
60
|
const { screenWidth, screenHeight, deviceOrientation, platform } = wx.getSystemInfoSync()
|
|
61
|
-
const
|
|
61
|
+
const isPadSize = (screenWidth >= 768 && deviceOrientation === 'portrait') || (screenHeight >= 768 && deviceOrientation === 'landscape')
|
|
62
62
|
const isPcEquipment = platform === 'windows' || platform === 'mac' || platform === 'devtools'
|
|
63
|
-
const
|
|
63
|
+
const pcHighResolution = screenHeight >= 768
|
|
64
64
|
let deviceWidth = 750
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
// ipad平板
|
|
66
|
+
if (isPadSize) deviceWidth = 1536
|
|
67
|
+
// PC高分辨率或PC放大项目
|
|
68
|
+
if (isPcEquipment) deviceWidth = pcHighResolution ? 1536 : 1260
|
|
69
69
|
return `${rpx * 100 / deviceWidth}vmin`
|
|
70
70
|
}
|
package/package.json
CHANGED
|
@@ -58,13 +58,13 @@ export const isPhone = (val) => {
|
|
|
58
58
|
// 大屏适配 rpx 转 vmin
|
|
59
59
|
export const rpxToVmin = (rpx) => {
|
|
60
60
|
const { screenWidth, screenHeight, deviceOrientation, platform } = wx.getSystemInfoSync()
|
|
61
|
-
const
|
|
61
|
+
const isPadSize = (screenWidth >= 768 && deviceOrientation === 'portrait') || (screenHeight >= 768 && deviceOrientation === 'landscape')
|
|
62
62
|
const isPcEquipment = platform === 'windows' || platform === 'mac' || platform === 'devtools'
|
|
63
|
-
const
|
|
63
|
+
const pcHighResolution = screenHeight >= 768
|
|
64
64
|
let deviceWidth = 750
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
// ipad平板
|
|
66
|
+
if (isPadSize) deviceWidth = 1536
|
|
67
|
+
// PC高分辨率或PC放大项目
|
|
68
|
+
if (isPcEquipment) deviceWidth = pcHighResolution ? 1536 : 1260
|
|
69
69
|
return `${rpx * 100 / deviceWidth}vmin`
|
|
70
70
|
}
|