From be268f0aafc6513bfc74d90fbe4b3f895311c7b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Fri, 6 Sep 2024 11:39:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=82=AC=E6=B5=AE=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/layout/components/main/index.vue | 25 ++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/views/layout/components/main/index.vue b/src/views/layout/components/main/index.vue index 2958d1b7..950acdd7 100644 --- a/src/views/layout/components/main/index.vue +++ b/src/views/layout/components/main/index.vue @@ -287,12 +287,25 @@ const model_class = computed(() => { const model_style = computed(() => { return (item: { id: string; key: string }) => { - // window.innerHeight(当前页面高度) - 60(顶部高度) - 846(中间高度) - const height = (window.innerHeight - 906) / 2; - let bottom = parseInt(float_bottom[item.id]) + height; - // 容器自身高度是60 846-60 = 786 - if (parseInt(float_bottom[item.id]) > 786) { - bottom = 786 + height; + // 40是容器的上下间距, 60是顶部的高度 + const container_height = window.innerHeight - 100; + let bottom = 0; + if (container_height > 844) { + // 上下高度 + const height = (window.innerHeight - 906) / 2; + bottom = parseInt(float_bottom[item.id]) + height; + // 容器自身高度是60 846-60 = 786 + if (parseInt(float_bottom[item.id]) > 786) { + bottom = 786 + height; + } + } else { + // 一半的上下间距 + const height = 20; + bottom = parseInt(float_bottom[item.id]) + height; + // 容器自身高度是60 container_height-60 + if (parseInt(float_bottom[item.id]) > container_height - 60) { + bottom = container_height - 60 + height; + } } return item.key == 'float-window' ? `bottom: ${((bottom / window.innerHeight) * 100).toFixed(4) + '%'};` : ''; };