fix(Drawer): fix size number bug (#20718)

pull/20730/head
好多大米 2021-01-22 18:01:34 +08:00 committed by GitHub
parent b4efaa3d87
commit 18cf34f7b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -19,7 +19,7 @@
:aria-label="title"
class="el-drawer"
:class="[direction, customClass]"
:style="isHorizontal ? `width: ${size}` : `height: ${size}`"
:style="isHorizontal ? `width: ${drawerSize}` : `height: ${drawerSize}`"
ref="drawer"
role="dialog"
tabindex="-1"
@ -93,7 +93,7 @@ export default {
default: true
},
size: {
type: String,
type: [Number, String],
default: '30%'
},
title: {
@ -115,6 +115,9 @@ export default {
computed: {
isHorizontal() {
return this.direction === 'rtl' || this.direction === 'ltr';
},
drawerSize() {
return typeof this.size === 'number' ? `${this.size}px` : this.size;
}
},
data() {