Autocomplete: add change event (#17913)

This commit is contained in:
三咲智子 2020-04-10 16:43:53 +08:00 committed by GitHub
parent 73de4b655d
commit 3b7f95a308
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 2 deletions

View File

@ -659,6 +659,7 @@ Attribute | Description | Type | Options | Default
| Event Name | Description | Parameters |
|----| ----| ----|
|select | triggers when a suggestion is clicked | suggestion being clicked |
| change | triggers when the icon inside Input value change | (value: string \| number) |
### Autocomplete Methods

View File

@ -674,6 +674,7 @@ export default {
| Nombre | Descripción | Parametros |
| ------ | ----------------------------------------------- | ------------------------------------------ |
| select | se dispara cuando se hace clic a una sugerencia | sugerencia en la que se está haciendo clic |
| change | se activa cuando cambia el valor de entrada | (value: string \| number) |
### Autocomplete Metodo

View File

@ -660,6 +660,7 @@ export default {
| Nom | Description | Paramètres |
|----| ----| ----|
| select | Se déclenche quand une suggestion est cliquée. | La suggestion sélectionnée. |
| change | Se déclenche quand la valeur change. | (value: string \ number) |
### Méthodes de l'autocomplétion

View File

@ -769,6 +769,7 @@ export default {
| 事件名称 | 说明 | 回调参数 |
|---------|--------|---------|
| select | 点击选中建议项时触发 | 选中建议项 |
| change | 在 Input 值改变时触发 | (value: string \| number) |
### Autocomplete Methods
| 方法名 | 说明 | 参数 |

View File

@ -10,7 +10,8 @@
<el-input
ref="input"
v-bind="[$props, $attrs]"
@input="handleChange"
@input="handleInput"
@change="handleChange"
@focus="handleFocus"
@blur="handleBlur"
@clear="handleClear"
@ -186,7 +187,7 @@
}
});
},
handleChange(value) {
handleInput(value) {
this.$emit('input', value);
this.suggestionDisabled = false;
if (!this.triggerOnFocus && !value) {
@ -196,6 +197,9 @@
}
this.debouncedGetData(value);
},
handleChange(event) {
this.$emit('change', event.target.value);
},
handleFocus(event) {
this.activated = true;
this.$emit('focus', event);