Skip to content

Commit 9245a89

Browse files
committed
[fix] Fixed DropDown maxHeight prop.
1 parent 39e392a commit 9245a89

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/packages/drop-down/source/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
v-model="choosenValue"
5252
:options="options"
5353
:multiple="multiple"
54+
:maxHeight="maxHeight"
5455
:borderRadius="borderRadius"
5556
:checkBoxBackground="checkBoxBackground"
5657
:dropDownListForeground="dropDownListForeground"

src/packages/drop-down/source/list/listContainer.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,19 @@ export default {
160160
},
161161
methods: {
162162
stylesInit() {
163+
const hasMaxHeight =
164+
this.maxHeight !== '' &&
165+
this.maxHeight !== undefined &&
166+
this.maxHeight !== null;
163167
this.styles.listContainer.borderRadius = `${this.borderRadius}px`;
164168
this.styles.listContainer.background = this.dropDownListBackground;
165169
this.styles.listContainer.top = this.showStatus.top;
166170
this.styles.listContainer.bottom = this.showStatus.bottom;
167171
this.styles.listContainer.height = this.showStatus.height;
168-
this.styles.listContainer.maxHeight = `${this.showStatus.maxHeight}px`;
169-
this.styles.listContainer.overflow = this.showStatus.overflow;
172+
this.styles.listContainer.maxHeight = this.maxHeight;
173+
this.styles.listContainer.overflow = hasMaxHeight
174+
? 'auto'
175+
: this.showStatus.overflow;
170176
this.styles.title.color = this.dropDownListForeground;
171177
},
172178
valueTrigger(val) {

0 commit comments

Comments
 (0)