@@ -57,6 +57,11 @@
type: [Number, String],
default: 256
},
+ // 4.6.0
+ height: {
+ type: [Number, String],
+ default: 256
+ },
closable: {
type: Boolean,
default: true
@@ -79,9 +84,10 @@
type: Boolean,
default: false
},
+ // 4.6.0 add top, bottom
placement: {
validator (value) {
- return oneOf(value, ['left', 'right']);
+ return oneOf(value, ['left', 'right', 'top', 'bottom']);
},
default: 'right'
},
@@ -117,9 +123,12 @@
showHead: true,
canMove: false,
dragWidth: this.width,
+ dragHeight: this.height,
wrapperWidth: this.width,
+ wrapperHeight: this.height,
wrapperLeft: 0,
- minWidth: 256
+ minWidth: 256,
+ minHeight: 256
};
},
computed: {
@@ -138,13 +147,23 @@
mainStyles () {
let style = {};
- const width = parseInt(this.dragWidth);
+ if (this.placement === 'left' || this.placement === 'right') {
+ const width = parseInt(this.dragWidth);
- const styleWidth = {
- width: width <= 100 ? `${width}%` : `${width}px`
- };
+ const styleWidth = {
+ width: width <= 100 ? `${width}%` : `${width}px`
+ };
- Object.assign(style, styleWidth);
+ Object.assign(style, styleWidth);
+ } else {
+ const height = parseInt(this.dragHeight);
+
+ const styleHeight = {
+ height: height <= 100 ? `${height}%` : `${height}px`
+ };
+
+ Object.assign(style, styleHeight);
+ }
return style;
},
@@ -173,6 +192,11 @@
[`${prefixCls}-mask-inner`]: this.inner
}
];
+ },
+ transitionName () {
+ if (this.placement === 'left' || this.placement === 'right') return `move-${this.placement}`;
+ else if (this.placement === 'top') return 'move-up';
+ else return 'move-down';
}
},
methods: {
@@ -306,7 +330,10 @@
},
width (val) {
this.dragWidth = val;
+ },
+ height (val) {
+ this.dragHeight = val;
}
}
};
-
\ No newline at end of file
+
diff --git a/src/styles/components/drawer.less b/src/styles/components/drawer.less
index f07386ad..2e20b836 100644
--- a/src/styles/components/drawer.less
+++ b/src/styles/components/drawer.less
@@ -16,6 +16,14 @@
&-right{
right: 0;
}
+ &-top, &-bottom{
+ width: 100%;
+ height: auto;
+ top: auto;
+ }
+ &-bottom{
+ bottom: 0;
+ }
&-hidden {
display: none !important;
@@ -110,6 +118,17 @@
&-left{
right: 0;
}
+ &-top, &-bottom{
+ top: auto;
+ width: 100%;
+ height: 0;
+ }
+ &-top{
+ bottom: 0;
+ }
+ &-bottom{
+ top: 0;
+ }
&-move-trigger{
width: 8px;
height: 100px;
@@ -118,7 +137,7 @@
top: 50%;
background: rgb(243, 243, 243);
transform: translate(-50%, -50%);
- border-radius: ~"4px / 6px";
+ border-radius: 4px;
box-shadow: 0 0 1px 1px rgba(0, 0, 0, .2);
cursor: col-resize;
&-point{
@@ -132,5 +151,28 @@
}
}
}
+ &-top &-move-trigger, &-bottom &-move-trigger{
+ width: 100px;
+ height: 8px;
+ line-height: 8px;
+ top: auto;
+ left: 50%;
+ cursor: row-resize;
+ &-point{
+ width: 100%;
+ height: 50%;
+ transform: translateY(-75%);
+ text-align: center;
+ i{
+ display: inline-block;
+ border-bottom: inherit;
+ width: 1px;
+ height: 100%;
+ border-left: 1px solid rgb(192, 192, 192);
+ padding-bottom: inherit;
+ margin-left: 2px;
+ }
+ }
+ }
}
}