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