Procházet zdrojové kódy

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

杨奕 před 7 roky
rodič
revize
dd773b9e72
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  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);
     }
   };