소스 검색

InputNumber: fix accessing missing $refs in updated hook (#10995)

杨奕 7 년 전
부모
커밋
dd773b9e72
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      packages/input-number/src/input-number.vue

+ 2 - 1
packages/input-number/src/input-number.vue

@@ -216,7 +216,8 @@
       innerInput.setAttribute('aria-disabled', this.inputNumberDisabled);
     },
     updated() {
-      let innerInput = this.$refs.input.$refs.input;
+      if (!this.$refs || !this.$refs.input) return;
+      const innerInput = this.$refs.input.$refs.input;
       innerInput.setAttribute('aria-valuenow', this.currentValue);
     }
   };