1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| handleScreenRatio () { const system = wx.getSystemInfoSync();
const width = system.screenWidth * system.devicePixelRatio; const height = system.screenHeight * system.devicePixelRatio;
const list = [ [20, 9], [19.5, 9], [18, 9], [16, 10], [16, 9], ];
const seperator = ':';
for(let i in list) { let item = list[i];
if(Math.abs(~~(height / item[0]) - ~~(width / item[1])) < 3) { return item.join(seperator); } }
return '未知'; },
|