1
This commit is contained in:
@@ -26,10 +26,9 @@ const designHeight = 400
|
||||
// 获取屏幕宽度,如果没有传入width则使用屏幕宽度
|
||||
const windowWidth = Taro.getSystemInfoSync().windowWidth
|
||||
|
||||
// 获取 DPR - 使用系统像素比确保高清显示
|
||||
// const systemDpr = Taro.getSystemInfoSync().pixelRatio
|
||||
const dpr = 1
|
||||
// Math.min(systemDpr, 3) // 限制最大dpr为3,避免过度放大
|
||||
// 获取 DPR - 使用系统像素比确保高清显示,限制上限避免内存占用过高
|
||||
const systemDpr = Taro.getSystemInfoSync().pixelRatio || 1
|
||||
const dpr = Math.min(Math.max(systemDpr, 1), 2)
|
||||
|
||||
// 2. 计算缩放比例(设备宽度 / 设计稿宽度)
|
||||
const scale = windowWidth / designWidth
|
||||
|
||||
Reference in New Issue
Block a user