소스 검색

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) {