Kaynağa Gözat

fix a slider bug

Leopoldthecoder 9 yıl önce
ebeveyn
işleme
de94e0c0bc

+ 7 - 1
CHANGELOG.md

@@ -1,8 +1,14 @@
 ## 更新日志
 
+### 1.0.0-rc.3
+
+*2016-09-09*
+
+- 修复 Slider 存在输入框时,输入框与 Slider 的值不同步的问题
+
 ### 1.0.0-rc.2
 
-*2016-09-07*
+*2016-09-09*
 
 - 修复 Upload 上传的问题,并增加上传成功和失败的钩子函数
 - Button 组件增加 `nativeType` 属性,用于组件内 `<button>` 标签的原生 `type` 属性,默认值为 `button`

+ 3 - 3
examples/docs/slider.md

@@ -4,9 +4,9 @@
       return {
         value1: 0,
         value2: 50,
-        value3: null,
-        value4: null,
-        value5: null
+        value3: 0,
+        value4: 0,
+        value5: 0
       };
     }
   }

+ 4 - 0
packages/input-number/src/input-number.vue

@@ -95,6 +95,10 @@
       };
     },
     watch: {
+      value(val) {
+        this.currentValue = val;
+      },
+
       currentValue(newVal, oldVal) {
         if (!isNaN(newVal) && newVal <= this.max && newVal >= this.min) {
           this.$emit('change', newVal);

+ 1 - 1
packages/slider/src/main.vue

@@ -85,7 +85,7 @@
 
     watch: {
       inputValue(val) {
-        this.$emit('input', val);
+        this.$emit('input', Number(val));
       },
 
       showTip(val) {