perf: 优化iPadOS兼容性

This commit is contained in:
kuaifan 2025-06-17 12:01:33 +08:00
parent 43711a1a59
commit 618e482507
4 changed files with 31 additions and 2 deletions

View File

@ -204,7 +204,7 @@ export default {
&-close { &-close {
position: absolute; position: absolute;
top: 0; top: var(--status-bar-height, 0);
left: -40px; left: -40px;
z-index: 1; z-index: 1;
width: 40px; width: 40px;

View File

@ -1511,6 +1511,29 @@ const timezone = require("dayjs/plugin/timezone");
}; };
img.src = url; img.src = url;
}) })
},
/**
* 是否全屏根据尺寸对比
* @returns {boolean}
*/
isFullScreen() {
const windowWidth = $A(window).width();
const windowHeight = $A(window).height();
const screenWidth = window.screen.width;
const screenHeight = window.screen.height;
// 如果高比宽大,对调宽高
const adjustedWindowWidth = windowWidth > windowHeight ? windowWidth : windowHeight;
const adjustedWindowHeight = windowWidth > windowHeight ? windowHeight : windowWidth;
const adjustedScreenWidth = screenWidth > screenHeight ? screenWidth : screenHeight;
const adjustedScreenHeight = screenWidth > screenHeight ? screenHeight : screenWidth;
// 判断是否全屏误差1内视为全屏
const widthDiff = Math.abs(adjustedWindowWidth - adjustedScreenWidth);
const heightDiff = Math.abs(adjustedWindowHeight - adjustedScreenHeight);
return widthDiff <= 1 && heightDiff <= 1;
} }
}); });

View File

@ -27,6 +27,8 @@ export default {
state.windowLandscape = windowOrientation === 'landscape' state.windowLandscape = windowOrientation === 'landscape'
state.windowPortrait = windowOrientation === 'portrait' state.windowPortrait = windowOrientation === 'portrait'
state.windowIsFullScreen = $A.isFullScreen()
state.formOptions = { state.formOptions = {
class: windowWidth > 576 ? '' : 'form-label-weight-bold', class: windowWidth > 576 ? '' : 'form-label-weight-bold',
labelPosition: windowWidth > 576 ? 'right' : 'top', labelPosition: windowWidth > 576 ? 'right' : 'top',

View File

@ -1,6 +1,7 @@
const windowWidth = $A(window).width(), const windowWidth = $A(window).width(),
windowHeight = $A(window).height(), windowHeight = $A(window).height(),
windowOrientation = $A.screenOrientation() windowOrientation = $A.screenOrientation(),
windowIsFullScreen = $A.isFullScreen();
export default { export default {
// 客户端ID希望不变的除非清除浏览器缓存或者卸载应用 // 客户端ID希望不变的除非清除浏览器缓存或者卸载应用
@ -36,6 +37,9 @@ export default {
windowLandscape: windowOrientation === 'landscape', // 横屏 windowLandscape: windowOrientation === 'landscape', // 横屏
windowPortrait: windowOrientation === 'portrait', // 竖屏 windowPortrait: windowOrientation === 'portrait', // 竖屏
// 是否全屏
windowIsFullScreen: windowIsFullScreen,
// 表单布局 // 表单布局
formOptions: { formOptions: {
class: windowWidth > 576 ? '' : 'form-label-weight-bold', class: windowWidth > 576 ? '' : 'form-label-weight-bold',