Input: add select method (#10229)

pull/10233/head
杨奕 2018-03-19 12:17:57 +08:00 committed by GitHub
parent a294c628e9
commit 3377cd0847
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 6 deletions

View File

@ -684,6 +684,13 @@ Search data from server-side.
| change | triggers when the icon inside Input value change | (value: string \| number) |
| clear | triggers when the Input is cleared by the button which generated by the "clearable" attribute | (event: Event) |
### Input Methods
| Method | Description | Parameters |
|------|--------|-------|
| focus | focus the input element | — |
| select | select the text in input element | — |
### Autocomplete Attributes
Attribute | Description | Type | Options | Default
@ -718,7 +725,8 @@ Attribute | Description | Type | Options | Default
|----| ----| ----|
|select | triggers when a suggestion is clicked | suggestion being clicked |
### Methods
### Autocomplete Methods
| Method | Description | Parameters |
|------|--------|-------|
| focus | focus the Input component | — |
| focus | focus the input element | — |

View File

@ -663,6 +663,13 @@ Búsqueda de datos desde el servidor.
| change | se activa cuando cambia el valor de entrada | (value: string \| number) |
| clear | se dispara cuando la entrada es borrada por el botón generado por el atributo "clearable". | (event: Event) |
### Input Metodo
| Metodo | Descripción | Parametros |
| ------ | ----------------------------- | ---------- |
| focus | coloca el foco en el elemento | — |
| select | select the text in input element | — |
### Autocomplete Atributos
Atributo | Descripción | Tipo | Opciones | Por defecto
@ -695,7 +702,8 @@ Atributo | Descripción | Tipo | Opciones | Por defecto
| ------ | ---------------------------------------- | ---------------------------------------- |
| select | se dispara cuando se hace click a una sugerencia | sugerencia en la que se está haciendo click |
### Metodo
### Autocomplete Metodo
| Metodo | Descripción | Parametros |
| ------ | ----------------------------- | ---------- |
| focus | coloca el foco en el elemento | — |

View File

@ -841,7 +841,8 @@ export default {
### Input Methods
| 方法名 | 说明 | 参数 |
| ---- | ---- | ---- |
| focus | 使 input 获取焦点 | - |
| focus | 使 input 获取焦点 | — |
| select | 选中 input 中的文字 | — |
### Autocomplete Attributes
@ -873,3 +874,8 @@ export default {
| 事件名称 | 说明 | 回调参数 |
|---------|--------|---------|
| select | 点击选中建议项时触发 | 选中建议项 |
### Autocomplete Methods
| 方法名 | 说明 | 参数 |
| ---- | ---- | ---- |
| focus | 使 input 获取焦点 | - |

View File

@ -229,7 +229,7 @@
this.dispatch('ElFormItem', 'el.form.blur', [this.currentValue]);
}
},
inputSelect() {
select() {
(this.$refs.input || this.$refs.textarea).select();
},
resizeTextarea() {
@ -291,7 +291,7 @@
},
created() {
this.$on('inputSelect', this.inputSelect);
this.$on('inputSelect', this.select);
},
mounted() {

5
types/input.d.ts vendored
View File

@ -79,4 +79,9 @@ export declare class ElInput extends ElementUIComponent {
* Focus the Input component
*/
focus (): void
/**
* Select the text in input element
*/
select (): void
}