From bdbbfce823373968b47a16b265e71081f8228bce Mon Sep 17 00:00:00 2001 From: Leopoldthecoder Date: Mon, 26 Mar 2018 10:30:42 +0800 Subject: [PATCH] Input: add blur method --- examples/docs/en-US/input.md | 1 + examples/docs/es/input.md | 1 + examples/docs/zh-CN/input.md | 1 + packages/input/src/input.vue | 3 +++ types/input.d.ts | 5 +++++ 5 files changed, 11 insertions(+) diff --git a/examples/docs/en-US/input.md b/examples/docs/en-US/input.md index 9d489dcd7e..8af0a45347 100644 --- a/examples/docs/en-US/input.md +++ b/examples/docs/en-US/input.md @@ -689,6 +689,7 @@ Search data from server-side. | Method | Description | Parameters | |------|--------|-------| | focus | focus the input element | — | +| blur | blur the input element | — | | select | select the text in input element | — | ### Autocomplete Attributes diff --git a/examples/docs/es/input.md b/examples/docs/es/input.md index d89935b198..b0eb70d81a 100644 --- a/examples/docs/es/input.md +++ b/examples/docs/es/input.md @@ -668,6 +668,7 @@ Búsqueda de datos desde el servidor. | Metodo | Descripción | Parametros | | ------ | ----------------------------- | ---------- | | focus | coloca el foco en el elemento | — | +| blur | blur the input element | — | | select | select the text in input element | — | ### Autocomplete Atributos diff --git a/examples/docs/zh-CN/input.md b/examples/docs/zh-CN/input.md index 84b7516ac3..cb4fff514e 100644 --- a/examples/docs/zh-CN/input.md +++ b/examples/docs/zh-CN/input.md @@ -842,6 +842,7 @@ export default { | 方法名 | 说明 | 参数 | | ---- | ---- | ---- | | focus | 使 input 获取焦点 | — | +| blur | 使 input 失去焦点 | — | | select | 选中 input 中的文字 | — | ### Autocomplete Attributes diff --git a/packages/input/src/input.vue b/packages/input/src/input.vue index f5aa039851..9a642e7c23 100644 --- a/packages/input/src/input.vue +++ b/packages/input/src/input.vue @@ -211,6 +211,9 @@ focus() { (this.$refs.input || this.$refs.textarea).focus(); }, + blur() { + (this.$refs.input || this.$refs.textarea).blur(); + }, getMigratingConfig() { return { props: { diff --git a/types/input.d.ts b/types/input.d.ts index e6e76e4f76..3ac3b5c32d 100644 --- a/types/input.d.ts +++ b/types/input.d.ts @@ -80,6 +80,11 @@ export declare class ElInput extends ElementUIComponent { */ focus (): void + /** + * Blur the Input component + */ + blur (): void + /** * Select the text in input element */