diff --git a/pages/component/slider-100/slider-100.uvue b/pages/component/slider-100/slider-100.uvue index bade12cee2b6a54fce32f87960b2ebf94d2ab11d..551a7993a337ab256929384e51329b5c89f03af0 100644 --- a/pages/component/slider-100/slider-100.uvue +++ b/pages/component/slider-100/slider-100.uvue @@ -6,19 +6,19 @@ + @change="sliderChange" :value="sliderValue" :block-size="20" :show-value="true" /> + @change="sliderChange" :value="sliderValue" :block-size="20" :show-value="true" /> + @change="sliderChange" :value="sliderValue" :block-size="20" :show-value="true" /> + @change="sliderChange" :value="sliderValue" :block-size="20" :show-value="true" /> @@ -35,28 +35,33 @@ } }, methods: { + sliderChange(e : SliderChangeEvent) { + this.updateSliderValue(e.detail.value) + }, sliderChanging(e : SliderChangeEvent) { - // this.sliderValue = e.detail.value + this.updateSliderValue(e.detail.value) + }, + updateSliderValue(value : Number) { + // this.sliderValue = value // TODO 跳过vue框架,直接修改原生组件 - const sliderValue = e.detail.value; (this.$refs["slider1"]! as ComponentPublicInstance[]).forEach((item) => { - item.$data["$sliderValue"] = sliderValue + item.$data["$sliderValue"] = value item.$callMethod("_onRender") }); (this.$refs["slider2"]! as ComponentPublicInstance[]).forEach((item) => { - item.$data["$sliderValue"] = sliderValue + item.$data["$sliderValue"] = value item.$callMethod("_onRender") }); (this.$refs["slider3"]! as ComponentPublicInstance[]).forEach((item) => { - item.$data["$sliderValue"] = sliderValue + item.$data["$sliderValue"] = value item.$callMethod("_onRender") }); (this.$refs["slider4"]! as ComponentPublicInstance[]).forEach((item) => { - item.$data["$sliderValue"] = sliderValue + item.$data["$sliderValue"] = value item.$callMethod("_onRender") }); - }, + } }, } @@ -77,4 +82,4 @@ .slider { margin: 1px 0.5px; } - \ No newline at end of file +