提交 d5a8f5c8 编写于 作者: H hdx

slider-100: TODO 优化滑动时其他slider进度不一致问题

上级 b9f8f924
...@@ -5,20 +5,20 @@ ...@@ -5,20 +5,20 @@
<page-head :title="title"></page-head> <page-head :title="title"></page-head>
<view class="flex-row"> <view class="flex-row">
<view class="flex-fill"> <view class="flex-fill">
<slider v-for="(_, index1) in 25" :key="index1" class="slider" @changing="sliderChanging" :value="sliderValue" <slider ref="slider1" v-for="(_, index1) in 25" :key="index1" class="slider" @changing="sliderChanging"
:block-size="20" :show-value="true" /> :value="sliderValue" :block-size="20" :show-value="true" />
</view> </view>
<view class="flex-fill"> <view class="flex-fill">
<slider v-for="(_, index2) in 25" :key="index2" class="slider" @changing="sliderChanging" :value="sliderValue" <slider ref="slider2" v-for="(_, index2) in 25" :key="index2" class="slider" @changing="sliderChanging"
:block-size="20" :show-value="true" /> :value="sliderValue" :block-size="20" :show-value="true" />
</view> </view>
<view class="flex-fill"> <view class="flex-fill">
<slider v-for="(_, index3) in 25" :key="index3" class="slider" @changing="sliderChanging" :value="sliderValue" <slider ref="slider3" v-for="(_, index3) in 25" :key="index3" class="slider" @changing="sliderChanging"
:block-size="20" :show-value="true" /> :value="sliderValue" :block-size="20" :show-value="true" />
</view> </view>
<view class="flex-fill"> <view class="flex-fill">
<slider v-for="(_, index4) in 25" :key="index4" class="slider" @changing="sliderChanging" :value="sliderValue" <slider ref="slider4" v-for="(_, index4) in 25" :key="index4" class="slider" @changing="sliderChanging"
:block-size="20" :show-value="true" /> :value="sliderValue" :block-size="20" :show-value="true" />
</view> </view>
</view> </view>
<!-- #ifdef APP --> <!-- #ifdef APP -->
...@@ -36,7 +36,26 @@ ...@@ -36,7 +36,26 @@
}, },
methods: { methods: {
sliderChanging(e : SliderChangeEvent) { sliderChanging(e : SliderChangeEvent) {
this.sliderValue = e.detail.value // this.sliderValue = e.detail.value
// TODO
const sliderValue = e.detail.value;
(this.$refs["slider1"]! as ComponentPublicInstance[]).forEach((item) => {
item.$data["sliderValue"] = sliderValue
item.$callMethod("_onRender")
});
(this.$refs["slider2"]! as ComponentPublicInstance[]).forEach((item) => {
item.$data["sliderValue"] = sliderValue
item.$callMethod("_onRender")
});
(this.$refs["slider3"]! as ComponentPublicInstance[]).forEach((item) => {
item.$data["sliderValue"] = sliderValue
item.$callMethod("_onRender")
});
(this.$refs["slider4"]! as ComponentPublicInstance[]).forEach((item) => {
item.$data["sliderValue"] = sliderValue
item.$callMethod("_onRender")
});
}, },
}, },
} }
...@@ -56,6 +75,6 @@ ...@@ -56,6 +75,6 @@
} }
.slider { .slider {
margin: 2px 0.5px; margin: 1px 0.5px;
} }
</style> </style>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册