Skip to content

Commit b48c7f1

Browse files
author
Lionel Bijaoui
committed
fix #71 format value to properly interact with model and other fields
1 parent 11344c4 commit b48c7f1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/fields/fieldNoUiSlider.vue

+15
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@
3333
this.value = parseFloat(value);
3434
}
3535
},
36+
formatValueToField(value) {
37+
if(this.slider !== null && typeof this.slider.noUiSlider !== "undefined"){
38+
this.slider.noUiSlider.set(value);
39+
}
40+
},
41+
formatValueToModel() {
42+
if(typeof this.slider.noUiSlider !== "undefined"){
43+
let val = this.slider.noUiSlider.get();
44+
if (val instanceof Array) {
45+
return [Number(val[0]), Number(val[1])];
46+
}else{
47+
return Number(val);
48+
}
49+
}
50+
},
3651
getStartValue(){
3752
if (this.value != null) {
3853
return this.value;

0 commit comments

Comments
 (0)