This commit is contained in:
张成
2026-04-22 10:19:01 +08:00
parent 5a753e7822
commit b5081afb2c
4 changed files with 9 additions and 9 deletions

View File

@@ -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