Prechádzať zdrojové kódy

fix input blur event

baiyaaaaa 8 rokov pred
rodič
commit
634498bbff

+ 1 - 3
examples/docs/zh-CN/input.md

@@ -203,9 +203,7 @@
 
 ::: demo
 ```html
-<el-input
-  placeholder="请输入内容"
-  v-model="input">
+<el-input v-model="input" placeholder="请输入内容">
 </el-input>
 
 <script>

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

@@ -27,6 +27,7 @@
       @blur="handleBlur"
       :disabled="disabled"
       :size="size"
+      ref="input"
     >
         <template slot="prepend" v-if="$slots.prepend">
           <slot name="prepend"></slot>
@@ -191,7 +192,7 @@
         this.currentValue = this.accSub(value, this.step);
       },
       handleBlur() {
-        this.currentValue = this.value;
+        this.$refs.input.setCurrentValue(this.currentValue);
       }
     }
   };

+ 0 - 1
packages/input/src/input.vue

@@ -132,7 +132,6 @@
       handleBlur(event) {
         this.$emit('blur', event);
         this.dispatch('ElFormItem', 'el.form.blur', [this.currentValue]);
-        this.currentValue = this.value;
       },
       inputSelect() {
         this.$refs.input.select();