From 6b0f716782e3770de465fbbfe70cc4657120922e Mon Sep 17 00:00:00 2001 From: zazzaz Date: Mon, 25 Jan 2021 11:00:48 +0800 Subject: [PATCH] fix: Fix Drawer error size prop to support Number (#1335) --- packages/drawer/src/index.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/drawer/src/index.vue b/packages/drawer/src/index.vue index 00b53495b4..a853b7873a 100644 --- a/packages/drawer/src/index.vue +++ b/packages/drawer/src/index.vue @@ -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), } },