From b1b2fcb378dceb0cb07fded7927c87fc9c2eec4b Mon Sep 17 00:00:00 2001 From: ryuhangyeong Date: Thu, 16 Jun 2022 21:20:31 +0900 Subject: [PATCH] refactor(components): [dialog] using addUnit in the use-dialog --- packages/components/dialog/src/use-dialog.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/components/dialog/src/use-dialog.ts b/packages/components/dialog/src/use-dialog.ts index 3da94bbc8c741..14533eb18bf3c 100644 --- a/packages/components/dialog/src/use-dialog.ts +++ b/packages/components/dialog/src/use-dialog.ts @@ -16,7 +16,7 @@ import { useZIndex, } from '@element-plus/hooks' import { UPDATE_MODEL_EVENT } from '@element-plus/constants' -import { isNumber } from '@element-plus/utils' +import { addUnit } from '@element-plus/utils' import type { CSSProperties, Ref, SetupContext } from 'vue' import type { DialogEmits, DialogProps } from './dialog' @@ -40,10 +40,6 @@ export const useDialog = ( let openTimer: (() => void) | undefined = undefined let closeTimer: (() => void) | undefined = undefined - const normalizeWidth = computed(() => - isNumber(props.width) ? `${props.width}px` : props.width - ) - const namespace = useGlobalConfig('namespace', defaultNamespace) const style = computed(() => { @@ -54,7 +50,7 @@ export const useDialog = ( style[`${varPrefix}-margin-top`] = props.top } if (props.width) { - style[`${varPrefix}-width`] = normalizeWidth.value + style[`${varPrefix}-width`] = addUnit(props.width) } } return style