uniapp写的,引用页面:
<template>
<div style="position: absolute;">
<ul>
<li>renderWidth:{{renderWidth}}</li>
<li>renderHeight:{{renderHeight}}</li>
<li>width:{{width}}</li>
<li>height:{{height}}</li>
</ul>
<xr-start
disable-scroll
id="main-frame"
:width="renderWidth"
:height="renderHeight"
:style="`width:${width}px;height:${height}px;top:0;position:realtive`"
/>
</div>
</template>
<script lang="ts" setup>
import { onLoad } from "@dcloudio/uni-app";
import { ref } from "vue";
const width = ref(300);
const height = ref(300);
const renderWidth = ref(300);
const renderHeight = ref(300);
onLoad(() => {
// #ifdef MP-WEIXIN
const info = wx.getSystemInfoSync();
console.log(info,'info---------');
const _width = info.windowWidth;
const _height = info.windowHeight;
const _dpi = info.pixelRatio;
width.value = _width;
height.value = _height;
renderWidth.value = _width * _dpi;
renderHeight.value = _height * _dpi;
// #endif
});
</script>
<style></style>
安卓真机调试高度正常,但是垂直方向被拉升了。。。有老哥遇到过吗
我也遇到了同样的问题,如果找到解决方案了,麻烦告知一声