From e5dcb9759c7bec27f3860a00eda67063aaaaa1fa Mon Sep 17 00:00:00 2001 From: sight <1453017105@qq.com> Date: Sun, 13 Mar 2022 22:47:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(message):=20=E4=BF=AE=E5=A4=8D=E9=AB=98?= =?UTF-8?q?=E5=BA=A6=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/index.vue | 4 ++-- src/utils/index.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/component/index.vue b/src/component/index.vue index e50c85a..3cad50d 100644 --- a/src/component/index.vue +++ b/src/component/index.vue @@ -106,7 +106,7 @@ const min: Ref = ref(false); const type: number = calculateType(props.type); const area: Ref = ref(calculateArea(props.type, props.area, props.offset)); const offset: Ref = ref(calculateOffset(props.offset, area.value, props.type)); -const contentHeight = ref(calculateContent(area.value[1], props.btn, type)); +const contentHeight = ref(calculateContent(area.value[1], props.btn, type, props.isMessage)); const index: Ref = ref(props.zIndex); const visible: Ref = ref(false); const first: Ref = ref(true); @@ -317,7 +317,7 @@ watch( watch( () => h.value, () => { - contentHeight.value = calculateContent(h.value, props.btn, type); + contentHeight.value = calculateContent(h.value, props.btn, type, props.isMessage); } ); diff --git a/src/utils/index.ts b/src/utils/index.ts index 8432f13..18d7f94 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -132,13 +132,13 @@ export function calculateType(modalType: number | string) { // 计算高度 // @param height 高度 // @param btn 操作集合 -export function calculateContent(height: any, btn: any, type: any) { +export function calculateContent(height: any, btn: any, type: any, isMessage?: boolean) { if(height && height.indexOf("%")!=-1) { height = "100%"; } - if ((btn && btn.length > 0) || type === 0) { + if ((btn && btn.length > 0)) { if (type === 0) { - return "calc(" + height + " - 137px)"; + return "calc(" + height + " - 137px)"; // height - (title + btn + contentPadding * 2) } if (type === 1) { return "calc(" + height + " - 102px)"; @@ -148,7 +148,7 @@ export function calculateContent(height: any, btn: any, type: any) { } } else { if (type === 0) { - return "calc(" + height + " - 91px)"; + return isMessage ? height : "calc(" + height + " - 137px)"; // - (title + contentPadding * 2) } if (type === 1) { return "calc(" + height + " - 51px)"; -- Gitee From e60f5f2d3e15cd855b068b84bbb2c435440c6998 Mon Sep 17 00:00:00 2001 From: sight <1453017105@qq.com> Date: Sun, 13 Mar 2022 23:03:09 +0800 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20=E5=88=A0=E9=99=A4=20calculateCont?= =?UTF-8?q?ent=20=E6=97=A0=E5=85=B3=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/index.ts b/src/utils/index.ts index 18d7f94..1181441 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -138,7 +138,7 @@ export function calculateContent(height: any, btn: any, type: any, isMessage?: b } if ((btn && btn.length > 0)) { if (type === 0) { - return "calc(" + height + " - 137px)"; // height - (title + btn + contentPadding * 2) + return "calc(" + height + " - 137px)"; } if (type === 1) { return "calc(" + height + " - 102px)"; @@ -148,7 +148,7 @@ export function calculateContent(height: any, btn: any, type: any, isMessage?: b } } else { if (type === 0) { - return isMessage ? height : "calc(" + height + " - 137px)"; // - (title + contentPadding * 2) + return isMessage ? height : "calc(" + height + " - 137px)"; } if (type === 1) { return "calc(" + height + " - 51px)"; -- Gitee