diff --git a/src/App.vue b/src/App.vue index ad7faf7..190afe1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,12 +1,58 @@ - - \ No newline at end of file + diff --git a/src/components/LandscapeGuard.vue b/src/components/LandscapeGuard.vue new file mode 100644 index 0000000..780e398 --- /dev/null +++ b/src/components/LandscapeGuard.vue @@ -0,0 +1,153 @@ + + + + + diff --git a/src/style.scss b/src/style.scss index f6812c6..f188935 100644 --- a/src/style.scss +++ b/src/style.scss @@ -29,6 +29,7 @@ * { padding: 0; margin: 0; + box-sizing: border-box; } html, @@ -37,3 +38,21 @@ body, width: 100%; height: 100%; } + +body { + overflow: hidden; +} + +html.is-portrait-tablet, +html.is-portrait-tablet body { + overflow: hidden !important; + background: #0b1526; +} + +html.is-portrait-tablet #app { + visibility: hidden; +} + +html.is-portrait-tablet .landscape-guard__mask { + visibility: visible; +} diff --git a/src/views/Address.vue b/src/views/Address.vue index d5693b2..cd3f511 100644 --- a/src/views/Address.vue +++ b/src/views/Address.vue @@ -144,6 +144,8 @@ const testConnect = async () => { :deep(.el-input__inner) { height: 40px; + // 避免 iPad Safari 聚焦小字号输入框时自动缩放页面。 + font-size: 16px; } .connect { diff --git a/src/views/Home.vue b/src/views/Home.vue index 4255e2c..8f90ace 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -36,14 +36,6 @@ import MechanicalArm from './arm/MechanicalArm.vue'; import Camera from './camera/index.vue' import { useRouter } from 'vue-router'; -import autofit from 'autofit.js' -autofit.init({ - designHeight: 1080, - designWidth: 1920, - renderDom: '#app', - resize: true - }) - const router = useRouter() const currentTime = ref('') @@ -83,25 +75,12 @@ const back = () => { router.back() } -const resetAutoFit = () => { - autofit.destroy() // 销毁旧缩放 - autofit.init({ - designHeight: 1080, - designWidth: 1920, - renderDom: '#app', - resize: true - }) -} - let clockTimer, binaryTimer; onMounted(() => { updateClock(); clockTimer = setInterval(updateClock, 1000); animateBinary() binaryTimer = setInterval(animateBinary, 400); - - document.addEventListener('fullscreenchange', resetAutoFit) - document.addEventListener('webkitfullscreenchange', resetAutoFit) }) onUnmounted(() => {