2***@qq.com
2***@qq.com
  • 发布:2022-05-14 15:11
  • 更新:2022-05-16 11:14
  • 阅读:172

获取APP手机分辩率不一致

分类:uni-app
  1. 高度与宽度与实际手机相关差一点
  2. 两个APP 获取 的高度也不一致
    程序1:14:31:43.428 mounted screenWidth:411,screenHeight798,pixelRatio2.625,width:1078.875,Height:2094.75 at App.vue:40
    程序1:14:35:53.473 mounted screenWidth:411,screenHeight846,pixelRatio2.625,width:1078.875,Height:2220.75 at App.vue:66

screenHeight 不一致
实际手机分辩率: 2220X 1080(三生Note8)

求指导, 代码如下
setInterval(function() {
uni.getSystemInfo({
success: function (res) {
console.log(res.model);
console.log('pixelRatio',res.pixelRatio);
console.log('windowWidth',res.windowWidth);
console.log('windowHeight',res.windowHeight);

                console.log('screenWidth',res.screenWidth);  
                console.log('screenHeight',res.screenHeight);  
                console.log("windowTop",res.windowTop);  
                console.log("windowBottom",res.windowBottom);  
                console.log(res.language);  
                console.log(res.version);  
                console.log(res.platform);  
            }  
        });  
        const {  
            screenWidth,  
            screenHeight,  
            pixelRatio  
        } = uni.getSystemInfoSync();  
        console.log("mounted screenWidth:" + screenWidth+ ",screenHeight" + screenHeight+ ",pixelRatio" + pixelRatio+ ",width:" + (pixelRatio*screenWidth)+ ",Height:" + (pixelRatio*screenHeight));  
    }, 1000 * 3);  
2022-05-14 15:11 负责人:无 分享
已邀请:
DCloud_Android_DQQ

DCloud_Android_DQQ

你拿 hx 自带的 hello uni试试 有没有问题

  • 2***@qq.com (作者)

    和我的代码结果 一致

    2022-05-19 16:37

要回复问题请先登录注册