Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input: add select method #10229

Merged
merged 1 commit into from
Mar 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions examples/docs/en-US/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 | — |
10 changes: 9 additions & 1 deletion examples/docs/es/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 | — |
8 changes: 7 additions & 1 deletion examples/docs/zh-CN/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,8 @@ export default {
### Input Methods
| 方法名 | 说明 | 参数 |
| ---- | ---- | ---- |
| focus | 使 input 获取焦点 | - |
| focus | 使 input 获取焦点 | — |
| select | 选中 input 中的文字 | — |

### Autocomplete Attributes

Expand Down Expand Up @@ -873,3 +874,8 @@ export default {
| 事件名称 | 说明 | 回调参数 |
|---------|--------|---------|
| select | 点击选中建议项时触发 | 选中建议项 |

### Autocomplete Methods
| 方法名 | 说明 | 参数 |
| ---- | ---- | ---- |
| focus | 使 input 获取焦点 | - |
4 changes: 2 additions & 2 deletions packages/input/src/input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
this.dispatch('ElFormItem', 'el.form.blur', [this.currentValue]);
}
},
inputSelect() {
select() {
(this.$refs.input || this.$refs.textarea).select();
},
resizeTextarea() {
Expand Down Expand Up @@ -291,7 +291,7 @@
},

created() {
this.$on('inputSelect', this.inputSelect);
this.$on('inputSelect', this.select);
},

mounted() {
Expand Down
5 changes: 5 additions & 0 deletions types/input.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,9 @@ export declare class ElInput extends ElementUIComponent {
* Focus the Input component
*/
focus (): void

/**
* Select the text in input element
*/
select (): void
}