From f3fbb57dc944a11a06be2eff376d77f9cef29813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=97=E5=A4=A7?= Date: Wed, 17 Jan 2024 19:37:45 +0800 Subject: [PATCH] fix: typo substract -> subtract (#3551) --- src/hooks/web/useContentHeight.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/hooks/web/useContentHeight.ts b/src/hooks/web/useContentHeight.ts index af7ff1bc..5c122dd4 100644 --- a/src/hooks/web/useContentHeight.ts +++ b/src/hooks/web/useContentHeight.ts @@ -1,8 +1,8 @@ -import { ComputedRef, isRef, nextTick, Ref, ref, unref, watch } from 'vue'; -import { onMountedOrActivated, useWindowSizeFn } from '@vben/hooks'; import { useLayoutHeight } from '@/layouts/default/content/useContentViewHeight'; import { getViewportOffset } from '@/utils/domUtils'; import { isNumber, isString } from '@/utils/is'; +import { onMountedOrActivated, useWindowSizeFn } from '@vben/hooks'; +import { ComputedRef, isRef, nextTick, Ref, ref, unref, watch } from 'vue'; export interface CompensationHeight { // 使用 layout Footer 高度作为判断补偿高度的条件 @@ -20,7 +20,7 @@ type Upward = number | string | null | undefined; * @param flag 用于开启计算的响应式标识 * @param anchorRef 锚点组件 Ref * @param subtractHeightRefs 待减去高度的组件列表 Ref - * @param substractSpaceRefs 待减去空闲空间(margins/paddings)的组件列表 Ref + * @param subtractSpaceRefs 待减去空闲空间(margins/paddings)的组件列表 Ref * @param offsetHeightRef 计算偏移的响应式高度,计算高度时将直接减去此值 * @param upwardSpace 向上递归减去空闲空间的 层级 或 直到指定class为止 数值为2代表向上递归两次|数值为ant-layout表示向上递归直到碰见.ant-layout为止 * @returns 响应式高度 @@ -29,7 +29,7 @@ export function useContentHeight( flag: ComputedRef, anchorRef: Ref, subtractHeightRefs: Ref[], - substractSpaceRefs: Ref[], + subtractSpaceRefs: Ref[], upwardSpace: Ref | ComputedRef | Upward = 0, offsetHeightRef: Ref = ref(0), ) { @@ -100,16 +100,16 @@ export function useContentHeight( } const { bottomIncludeBody } = getViewportOffset(anchorEl); - // substract elements height - let substractHeight = 0; + // subtract elements height + let subtractHeight = 0; subtractHeightRefs.forEach((item) => { - substractHeight += getEl(unref(item))?.offsetHeight ?? 0; + subtractHeight += getEl(unref(item))?.offsetHeight ?? 0; }); // subtract margins / paddings - let substractSpaceHeight = calcSubtractSpace(anchorEl) ?? 0; - substractSpaceRefs.forEach((item) => { - substractSpaceHeight += calcSubtractSpace(getEl(unref(item))); + let subtractSpaceHeight = calcSubtractSpace(anchorEl) ?? 0; + subtractSpaceRefs.forEach((item) => { + subtractSpaceHeight += calcSubtractSpace(getEl(unref(item))); }); // upwardSpace @@ -144,8 +144,8 @@ export function useContentHeight( bottomIncludeBody - unref(layoutFooterHeightRef) - unref(offsetHeightRef) - - substractHeight - - substractSpaceHeight - + subtractHeight - + subtractSpaceHeight - upwardSpaceHeight; // compensation height