fix: typo substract -> subtract (#3551)

This commit is contained in:
苗大 2024-01-17 19:37:45 +08:00 committed by GitHub
parent a121b32252
commit f3fbb57dc9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 12 deletions

View File

@ -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 { useLayoutHeight } from '@/layouts/default/content/useContentViewHeight';
import { getViewportOffset } from '@/utils/domUtils'; import { getViewportOffset } from '@/utils/domUtils';
import { isNumber, isString } from '@/utils/is'; 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 { export interface CompensationHeight {
// 使用 layout Footer 高度作为判断补偿高度的条件 // 使用 layout Footer 高度作为判断补偿高度的条件
@ -20,7 +20,7 @@ type Upward = number | string | null | undefined;
* @param flag * @param flag
* @param anchorRef Ref<ElRef | ComponentRef> * @param anchorRef Ref<ElRef | ComponentRef>
* @param subtractHeightRefs Ref<ElRef | ComponentRef> * @param subtractHeightRefs Ref<ElRef | ComponentRef>
* @param substractSpaceRefs (margins/paddings) Ref<ElRef | ComponentRef> * @param subtractSpaceRefs (margins/paddings) Ref<ElRef | ComponentRef>
* @param offsetHeightRef * @param offsetHeightRef
* @param upwardSpace class为止 2|ant-layout表示向上递归直到碰见.ant-layout为止 * @param upwardSpace class为止 2|ant-layout表示向上递归直到碰见.ant-layout为止
* @returns * @returns
@ -29,7 +29,7 @@ export function useContentHeight(
flag: ComputedRef<Boolean>, flag: ComputedRef<Boolean>,
anchorRef: Ref, anchorRef: Ref,
subtractHeightRefs: Ref[], subtractHeightRefs: Ref[],
substractSpaceRefs: Ref[], subtractSpaceRefs: Ref[],
upwardSpace: Ref<Upward> | ComputedRef<Upward> | Upward = 0, upwardSpace: Ref<Upward> | ComputedRef<Upward> | Upward = 0,
offsetHeightRef: Ref<number> = ref(0), offsetHeightRef: Ref<number> = ref(0),
) { ) {
@ -100,16 +100,16 @@ export function useContentHeight(
} }
const { bottomIncludeBody } = getViewportOffset(anchorEl); const { bottomIncludeBody } = getViewportOffset(anchorEl);
// substract elements height // subtract elements height
let substractHeight = 0; let subtractHeight = 0;
subtractHeightRefs.forEach((item) => { subtractHeightRefs.forEach((item) => {
substractHeight += getEl(unref(item))?.offsetHeight ?? 0; subtractHeight += getEl(unref(item))?.offsetHeight ?? 0;
}); });
// subtract margins / paddings // subtract margins / paddings
let substractSpaceHeight = calcSubtractSpace(anchorEl) ?? 0; let subtractSpaceHeight = calcSubtractSpace(anchorEl) ?? 0;
substractSpaceRefs.forEach((item) => { subtractSpaceRefs.forEach((item) => {
substractSpaceHeight += calcSubtractSpace(getEl(unref(item))); subtractSpaceHeight += calcSubtractSpace(getEl(unref(item)));
}); });
// upwardSpace // upwardSpace
@ -144,8 +144,8 @@ export function useContentHeight(
bottomIncludeBody - bottomIncludeBody -
unref(layoutFooterHeightRef) - unref(layoutFooterHeightRef) -
unref(offsetHeightRef) - unref(offsetHeightRef) -
substractHeight - subtractHeight -
substractSpaceHeight - subtractSpaceHeight -
upwardSpaceHeight; upwardSpaceHeight;
// compensation height // compensation height