瀏覽代碼

Select: focus input in setSoftFocus when available (#10801)

杨奕 7 年之前
父節點
當前提交
9a1afc3b33
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      packages/select/src/select.vue

+ 4 - 1
packages/select/src/select.vue

@@ -683,7 +683,10 @@
 
       setSoftFocus() {
         this.softFocus = true;
-        (this.$refs.input || this.$refs.reference).focus();
+        const input = this.$refs.input || this.$refs.reference;
+        if (input) {
+          input.focus();
+        }
       },
 
       getValueIndex(arr = [], value) {