Commit ba264fab authored by Leopoldthecoder's avatar Leopoldthecoder

fix Select automatically expand issue

parent 3d6beb1d
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
- 新增 Input textarea 类型的 rows, autosize 属性 - 新增 Input textarea 类型的 rows, autosize 属性
- 为 Tree 添加 getCheckedNodes 方法和 node-click、check-change 回调 - 为 Tree 添加 getCheckedNodes 方法和 node-click、check-change 回调
- 新增 DatePicker 禁用日期功能 #253 - 新增 DatePicker 禁用日期功能 #253
- 修复 多选可搜索的 Select 下拉选项自动展开的问题
#### 非兼容性更新 #### 非兼容性更新
......
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
this.index = this.parent.options.indexOf(this); this.index = this.parent.options.indexOf(this);
if (this.currentSelected === true) { if (this.currentSelected === true) {
this.dispatch('select', 'addOptionToValue', this); this.dispatch('select', 'addOptionToValue', [this, true]);
} }
this.$on('queryChange', this.queryChange); this.$on('queryChange', this.queryChange);
......
...@@ -214,6 +214,11 @@ ...@@ -214,6 +214,11 @@
selected(val) { selected(val) {
if (this.multiple) { if (this.multiple) {
if (this.selected.length > 0) {
this.currentPlaceholder = '';
} else {
this.currentPlaceholder = this.cachedPlaceHolder;
}
if (this.selectedInit) { if (this.selectedInit) {
this.selectedInit = false; this.selectedInit = false;
return; return;
...@@ -223,11 +228,6 @@ ...@@ -223,11 +228,6 @@
this.$emit('input', result); this.$emit('input', result);
this.$emit('change', result); this.$emit('change', result);
if (this.selected.length > 0) {
this.currentPlaceholder = '';
} else {
this.currentPlaceholder = this.cachedPlaceHolder;
}
this.$nextTick(() => { this.$nextTick(() => {
this.resetInputHeight(); this.resetInputHeight();
}); });
...@@ -340,10 +340,10 @@ ...@@ -340,10 +340,10 @@
} }
}, },
addOptionToValue(option) { addOptionToValue(option, init) {
if (this.multiple) { if (this.multiple) {
if (this.selected.indexOf(option) === -1 && (this.remote ? this.value.indexOf(option.value) === -1 : true)) { if (this.selected.indexOf(option) === -1 && (this.remote ? this.value.indexOf(option.value) === -1 : true)) {
this.selectedInit = false; this.selectedInit = !!init;
this.selected.push(option); this.selected.push(option);
this.resetHoverIndex(); this.resetHoverIndex();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment