From 7c06a10175a6f743a23d9f4ee86df3b4245f5e66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E7=A5=A5?= Date: Wed, 16 Nov 2016 11:38:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E6=95=88=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Line 34 dpr 值在第一行就已经被限制死了,为 false 的情况才能进入条件内,那么在条件内确定 dpr 值的时候有 devicePixelRatio 的判断就已经足够了。 --- src/flexible.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/flexible.js b/src/flexible.js index 4e7c545..1b4c87c 100644 --- a/src/flexible.js +++ b/src/flexible.js @@ -37,9 +37,9 @@ var devicePixelRatio = win.devicePixelRatio; if (isIPhone) { // iOS下,对于2和3的屏,用2倍的方案,其余的用1倍方案 - if (devicePixelRatio >= 3 && (!dpr || dpr >= 3)) { + if (devicePixelRatio >= 3) { dpr = 3; - } else if (devicePixelRatio >= 2 && (!dpr || dpr >= 2)){ + } else if (devicePixelRatio >= 2){ dpr = 2; } else { dpr = 1; @@ -114,4 +114,4 @@ return val; } -})(window, window['lib'] || (window['lib'] = {})); \ No newline at end of file +})(window, window['lib'] || (window['lib'] = {}));