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