修复部署后iOS设备高度塌陷问题

This commit is contained in:
bb_pan 2025-02-13 16:29:34 +08:00
parent 90504db81d
commit 84678f0a61
4 changed files with 21 additions and 9 deletions

View File

@ -19,8 +19,24 @@
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
// 修复 iOS 下页面高度异常问题
function adjustForiOS() {
var u = navigator.userAgent;
console.log('🚀 ~ u:', u);
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
console.log('🚀 ~ isiOS:', isiOS);
if (isiOS) {
var box = document.getElementById('box');
if (box) {
box.style.height = '100px';
}
}
}
document.addEventListener('DOMContentLoaded', adjustForiOS);
</script>
</script>
<title>
安徽租赁商城
</title>
@ -29,6 +45,7 @@
</head>
<body>
<div id="box"></div>
<div id="app"><!--app-html--></div>
<script type="module" src="/src/main.js"></script>

View File

@ -45,10 +45,5 @@ scroll-view {
white-space: nowrap;
}
@supports (bottom: env(safe-area-inset-bottom)) {
#app {
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
}
</style>

View File

@ -91,7 +91,7 @@ export const http = (options) => {
fail(err) {
uni.showToast({
icon: 'none',
title: '请求失败' + err,
title: '请求失败' + err.errMsg,
})
console.log(err, '请求失败')
reject(err)

View File

@ -34,7 +34,7 @@ export default defineConfig({
// 在此处编写代理规则
'/api': {
target: 'http://36.33.26.201:17788/proxyApi',
// target: 'http://192.168.2.123:28080',
// target: 'http://192.168.0.15:28080',
// target: 'http://192.168.2.122:28080',
// target: 'http://192.168.0.244:28580', // 测试服务
// target: 'http://192.168.2.122:28080', // 测试服务