mirror of https://github.com/ElemeFE/element
improve docs
parent
964eb5ad84
commit
d0097cec14
|
@ -473,7 +473,7 @@ Search and select options directly.
|
|||
|---------- |-------------------- |---------|------------- |-------- |
|
||||
| options | data source of the options | array | — | — |
|
||||
| value | selected value | array | — | — |
|
||||
| popup-class | className of popup overlay | string | — | — |
|
||||
| popper-class | className of popup overlay | string | — | — |
|
||||
| placeholder | input placeholder | string | — | — |
|
||||
| disabled | 是否禁用 | boolean | — | false |
|
||||
| clearable | whether allow clear | boolean | — | false |
|
||||
|
|
|
@ -477,7 +477,7 @@
|
|||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| options | 可选项数据源 | array | — | — |
|
||||
| value | 指定选中项 | array | — | — |
|
||||
| popup-class | 自定义浮层类名 | string | — | — |
|
||||
| popper-class | 自定义浮层类名 | string | — | — |
|
||||
| placeholder | 输入框占位文本 | string | — | — |
|
||||
| disabled | 是否禁用 | boolean | — | false |
|
||||
| clearable | 是否支持清除 | boolean | — | false |
|
||||
|
|
|
@ -215,7 +215,7 @@
|
|||
value: '选项5',
|
||||
label: '北京烤鸭'
|
||||
}],
|
||||
value2: '选项2'
|
||||
value2: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,6 +146,7 @@ export default {
|
|||
|
||||
this.menu.value = this.currentValue.slice(0);
|
||||
this.menu.visible = true;
|
||||
this.menu.options = this.options;
|
||||
this.menu.$on('pick', this.handlePick);
|
||||
this.updatePopper();
|
||||
this.$nextTick(_ => {
|
||||
|
@ -153,18 +154,20 @@ export default {
|
|||
});
|
||||
},
|
||||
hideMenu() {
|
||||
this.menu.visible = false;
|
||||
this.inputValue = '';
|
||||
this.menu.visible = false;
|
||||
},
|
||||
handlePick(value, close = true) {
|
||||
this.currentValue = value;
|
||||
this.$emit('input', value);
|
||||
this.$emit('change', value);
|
||||
|
||||
if (close) {
|
||||
this.menuVisible = false;
|
||||
}
|
||||
},
|
||||
handleInputChange(value) {
|
||||
if (!this.menuVisible) return;
|
||||
const flatOptions = this.flatOptions;
|
||||
|
||||
if (!value) {
|
||||
|
@ -228,9 +231,12 @@ export default {
|
|||
this.menuVisible = false;
|
||||
},
|
||||
handleClick() {
|
||||
if (!this.disabled) {
|
||||
this.menuVisible = !this.menuVisible;
|
||||
if (this.disabled) return;
|
||||
if (this.filterable) {
|
||||
this.menuVisible = true;
|
||||
return;
|
||||
}
|
||||
this.menuVisible = !this.menuVisible;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
cache: false,
|
||||
get() {
|
||||
const activeValue = this.activeValue;
|
||||
let options = this.options;
|
||||
|
||||
const loadActiveOptions = (options, activeOptions = []) => {
|
||||
const level = activeOptions.length;
|
||||
|
@ -49,9 +48,7 @@
|
|||
return activeOptions;
|
||||
};
|
||||
|
||||
const result = loadActiveOptions(options);
|
||||
|
||||
return result;
|
||||
return loadActiveOptions(this.options);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue