Bladeren bron

Input: add blur method (#10356)

杨奕 7 jaren geleden
bovenliggende
commit
5d6fe5eb2c
5 gewijzigde bestanden met toevoegingen van 11 en 0 verwijderingen
  1. 1 0
      examples/docs/en-US/input.md
  2. 1 0
      examples/docs/es/input.md
  3. 1 0
      examples/docs/zh-CN/input.md
  4. 3 0
      packages/input/src/input.vue
  5. 5 0
      types/input.d.ts

+ 1 - 0
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

+ 1 - 0
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

+ 1 - 0
examples/docs/zh-CN/input.md

@@ -842,6 +842,7 @@ export default {
 | 方法名 | 说明 | 参数 |
 | ---- | ---- | ---- |
 | focus | 使 input 获取焦点 | — |
+| blur | 使 input 失去焦点 | — |
 | select | 选中 input 中的文字 | — |
 
 ### Autocomplete Attributes

+ 3 - 0
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: {

+ 5 - 0
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
    */