提交 4be41435 编写于 作者: H hdx

slider-100: 调整示例

上级 78a83930
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</template> </template>
<script> <script>
import { ComponentPublicInstance } from 'vue'; type SliderRender = (value : number) => void
export default { export default {
data() { data() {
return { return {
...@@ -45,22 +45,18 @@ ...@@ -45,22 +45,18 @@
updateSliderValue(value : Number) { updateSliderValue(value : Number) {
// this.sliderValue = value // this.sliderValue = value
// 跳过vue框架,直接修改原生组件 // TODO 跳过vue框架,直接修改原生组件
(this.$refs["slider1"]! as ComponentPublicInstance[]).forEach((item) => { (this.$refs["slider1"]! as Element[]).forEach((item) => {
item.$data["$sliderValue"] = value (item.ext['render'] as SliderRender)(value)
item.$callMethod("_onRender")
}); });
(this.$refs["slider2"]! as ComponentPublicInstance[]).forEach((item) => { (this.$refs["slider2"]! as Element[]).forEach((item) => {
item.$data["$sliderValue"] = value (item.ext['render'] as SliderRender)(value)
item.$callMethod("_onRender")
}); });
(this.$refs["slider3"]! as ComponentPublicInstance[]).forEach((item) => { (this.$refs["slider3"]! as Element[]).forEach((item) => {
item.$data["$sliderValue"] = value (item.ext['render'] as SliderRender)(value)
item.$callMethod("_onRender")
}); });
(this.$refs["slider4"]! as ComponentPublicInstance[]).forEach((item) => { (this.$refs["slider4"]! as Element[]).forEach((item) => {
item.$data["$sliderValue"] = value (item.ext['render'] as SliderRender)(value)
item.$callMethod("_onRender")
}); });
} }
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册