mirror of https://github.com/ElemeFE/element
Autocomplete: add clearable prop (#12171)
* Autocomplete: add clearable prop * Input: remove focus after clearing the value * Autocomplete: hide options after clearing the valuepull/13415/head
parent
d37f74f539
commit
026558682c
|
@ -699,6 +699,7 @@ Search data from server-side.
|
||||||
Attribute | Description | Type | Options | Default
|
Attribute | Description | Type | Options | Default
|
||||||
|----| ----| ----| ---- | -----|
|
|----| ----| ----| ---- | -----|
|
||||||
|placeholder| the placeholder of Autocomplete| string | — | — |
|
|placeholder| the placeholder of Autocomplete| string | — | — |
|
||||||
|
| clearable | whether to show clear button | boolean | — | false |
|
||||||
|disabled | whether Autocomplete is disabled | boolean | — | false|
|
|disabled | whether Autocomplete is disabled | boolean | — | false|
|
||||||
| value-key | key name of the input suggestion object for display | string | — | value |
|
| value-key | key name of the input suggestion object for display | string | — | value |
|
||||||
|icon | icon name | string | — | — |
|
|icon | icon name | string | — | — |
|
||||||
|
|
|
@ -90,6 +90,10 @@
|
||||||
popperClass: String,
|
popperClass: String,
|
||||||
popperOptions: Object,
|
popperOptions: Object,
|
||||||
placeholder: String,
|
placeholder: String,
|
||||||
|
clearable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
name: String,
|
name: String,
|
||||||
size: String,
|
size: String,
|
||||||
|
@ -195,6 +199,7 @@
|
||||||
this.$emit('blur', event);
|
this.$emit('blur', event);
|
||||||
},
|
},
|
||||||
handleClear() {
|
handleClear() {
|
||||||
|
this.activated = false;
|
||||||
this.$emit('clear');
|
this.$emit('clear');
|
||||||
},
|
},
|
||||||
close(e) {
|
close(e) {
|
||||||
|
|
|
@ -330,7 +330,6 @@
|
||||||
this.$emit('change', '');
|
this.$emit('change', '');
|
||||||
this.$emit('clear');
|
this.$emit('clear');
|
||||||
this.setCurrentValue('');
|
this.setCurrentValue('');
|
||||||
this.focus();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,9 @@ export declare class ElAutocomplete extends ElementUIComponent {
|
||||||
/** The placeholder of Autocomplete */
|
/** The placeholder of Autocomplete */
|
||||||
placeholder: string
|
placeholder: string
|
||||||
|
|
||||||
|
/** Whether to show clear button */
|
||||||
|
clearable: boolean
|
||||||
|
|
||||||
/** Whether Autocomplete is disabled */
|
/** Whether Autocomplete is disabled */
|
||||||
disabled: boolean
|
disabled: boolean
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue