fix: Fix Drawer error size prop to support Number (#1335)

This commit is contained in:
zazzaz 2021-01-25 11:00:48 +08:00 committed by GitHub
parent d58f480aa3
commit 6b0f716782
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,7 @@
aria-labelledby="el-drawer__title" aria-labelledby="el-drawer__title"
:aria-label="title" :aria-label="title"
:class="['el-drawer', direction, customClass]" :class="['el-drawer', direction, customClass]"
:style="isHorizontal ? 'width: ' + size : 'height: ' + size" :style="isHorizontal ? 'width: ' + drawerSize : 'height: ' + drawerSize"
role="dialog" role="dialog"
@click.stop @click.stop
> >
@ -104,7 +104,7 @@ export default defineComponent({
default: true, default: true,
}, },
size: { size: {
type: String, type: [String, Number],
default: '30%', default: '30%',
}, },
title: { title: {
@ -159,6 +159,7 @@ export default defineComponent({
...useDialog(props, ctx as SetupContext, drawerRef), ...useDialog(props, ctx as SetupContext, drawerRef),
drawerRef, drawerRef,
isHorizontal: computed(() => props.direction === 'rtl' || props.direction === 'ltr'), isHorizontal: computed(() => props.direction === 'rtl' || props.direction === 'ltr'),
drawerSize: computed(() => typeof props.size === 'number' ? `${props.size}px` : props.size),
} }
}, },