فهرست منبع

Select: add blur method

Leopoldthecoder 7 سال پیش
والد
کامیت
46b70a5b89
5فایلهای تغییر یافته به همراه13 افزوده شده و 0 حذف شده
  1. 1 0
      examples/docs/en-US/select.md
  2. 1 0
      examples/docs/es/select.md
  3. 1 0
      examples/docs/zh-CN/select.md
  4. 5 0
      packages/select/src/select.vue
  5. 5 0
      types/select.d.ts

+ 1 - 0
examples/docs/en-US/select.md

@@ -713,3 +713,4 @@ If the binding value of Select is an object, make sure to assign `value-key` as
 | Method | Description | Parameters |
 |------|--------|-------|
 | focus | focus the Input component | - |
+| blur | blur the Input component, and hide the dropdown | - |

+ 1 - 0
examples/docs/es/select.md

@@ -719,3 +719,4 @@ Si el valor de encuadernación de Select es un objeto, asegúrese de asignar `va
 | Metodo | Descripción                 | Parametros |
 | ------ | --------------------------- | ---------- |
 | focus  | Foco en el componente input | -          |
+| blur   | blur the Input component, and hide the dropdown | - |

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

@@ -708,3 +708,4 @@
 | 方法名 | 说明 | 参数 |
 | ---- | ---- | ---- |
 | focus | 使 input 获取焦点 | - |
+| blur | 使 input 失去焦点,并隐藏下拉框 | - |

+ 5 - 0
packages/select/src/select.vue

@@ -537,6 +537,11 @@
         }
       },
 
+      blur() {
+        this.visible = false;
+        this.$refs.reference.blur();
+      },
+
       handleBlur(event) {
         this.$emit('blur', event);
       },

+ 5 - 0
types/select.d.ts

@@ -73,4 +73,9 @@ export declare class ElSelect extends ElementUIComponent {
    * Focus the Input component
    */
   focus (): void
+
+  /**
+   * Blur the Input component, and hide the dropdown
+   */
+  blur (): void
 }