瀏覽代碼

fix(#313): slider value label don't sync when set value

wangweimin 3 年之前
父節點
當前提交
ef4957fc47
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      webiojs/src/models/input/slider.ts

+ 6 - 0
webiojs/src/models/input/slider.ts

@@ -64,6 +64,12 @@ export class Slider extends InputItem {
 
     update_input(spec: any): any {
         let attributes = spec.attributes;
+        if ('value' in attributes) {
+            let range_value = this.element.find('.form-control-range-value');
+            range_value.text(
+                this.spec['float'] ? this.get_value().toFixed(2) : attributes.value
+            );
+        }
         this.update_input_helper(-1, attributes);
     }