微信小程序设置屏幕安全距离
<script setup>
import {
onMounted,
ref
} from 'vue';
let url = ref('');
onMounted(() => {
const windowInfo = wx.getWindowInfo();
let safe_left = 0; //屏幕左边安全距离
let safe_bottom = 0; //屏幕底部安全距离
safe_left = ((windowInfo.safeArea.left / windowInfo.screenWidth) * 750);
safe_bottom = (6 + (windowInfo.screenHeight - windowInfo.safeArea.bottom));
url.value = 'https://saas.carned.cn/Carned-Car2/static/index.html?safe_left=' + safe_left +
'px&safe_bottom=' + safe_bottom + 'px';
console.log(url.value)
})
</script>
原文地址:https://blog.csdn.net/weixin_46256404/article/details/143786441
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!