Skip to content

Commit

Permalink
refactor(components): [dialog] using addUnit in the use-dialog (#8304)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuhangyeong committed Jun 17, 2022
1 parent 1299d4a commit 4ac10cf
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/components/dialog/src/use-dialog.ts
Expand Up @@ -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'
Expand All @@ -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<CSSProperties>(() => {
Expand All @@ -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
Expand Down

0 comments on commit 4ac10cf

Please sign in to comment.