From e4fdd241a308f79bb4c061277d96b8ad02cf426b Mon Sep 17 00:00:00 2001 From: Guarp <guarp2022@163.com> Date: Sat, 22 Feb 2025 19:32:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=96=B0=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=20=20-=20=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E6=B5=8F=E8=A7=88=E5=99=A8=E7=9C=8B=E4=B8=8D?= =?UTF-8?q?=E8=A7=81=E5=BA=95=E9=83=A8=E6=A0=8F=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/test.vue | 5 +++-- src/utils/mobileTest.js | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 src/utils/mobileTest.js diff --git a/src/pages/test.vue b/src/pages/test.vue index f3c8064..8970497 100644 --- a/src/pages/test.vue +++ b/src/pages/test.vue @@ -5,6 +5,7 @@ import {onMounted, onUnmounted, ref, watch} from "vue"; import store from "../store/index.js"; import swal from "../utils/sweetalert.js"; import getCurrentTime from "../utils/getCurrentTime.js"; +import mobileTest from "../utils/mobileTest.js"; const contentInput = ref(store.state.editStore.blog || ''); const titleInput = ref(store.state.editStore.blogTitle || '') @@ -124,7 +125,7 @@ onUnmounted(() => { <input placeholder="输入标题" v-model="titleInput"> </div> <div class="top"> - <div class="function-btn"> + <div class="function-btn" :style="{flex: isMobileMode?1:3}"> <button v-if="! isMobileMode" v-for="btn in funcButtons" v-html="btn.name" @click="clickFuncBtn(btn.func)"/> <button v-if="isMobileMode" @click="isMenuOpen = ! isMenuOpen">☰</button> <div v-if="isMobileMode && isMenuOpen" class="function-btn-menu"> @@ -141,7 +142,7 @@ onUnmounted(() => { <button>提交</button> </div> </div> - <div class="middle"> + <div class="middle" :style="{maxHeight: `calc(100% - ${mobileTest() ? 200 : 125}px)`}"> <div v-if="portMode !== 'view'" class="left"> <textarea v-model="contentInput"></textarea> </div> diff --git a/src/utils/mobileTest.js b/src/utils/mobileTest.js new file mode 100644 index 0000000..142ffc5 --- /dev/null +++ b/src/utils/mobileTest.js @@ -0,0 +1,4 @@ +export default function mobileTest() { + const userAgent = navigator.userAgent.toLowerCase(); + return /mobile/i.test(userAgent) || /android/i.test(userAgent) || /iphone/i.test(userAgent); +} \ No newline at end of file