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

slider-100: 调整示例

上级 78a83930
<template> <template>
<!-- #ifdef APP --> <!-- #ifdef APP -->
<scroll-view class="page"> <scroll-view class="page">
<!-- #endif --> <!-- #endif -->
<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">
...@@ -21,13 +21,13 @@ ...@@ -21,13 +21,13 @@
@change="sliderChange" :value="sliderValue" :block-size="20" :show-value="true" /> @change="sliderChange" :value="sliderValue" :block-size="20" :show-value="true" />
</view> </view>
</view> </view>
<!-- #ifdef APP --> <!-- #ifdef APP -->
</scroll-view> </scroll-view>
<!-- #endif --> <!-- #endif -->
</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")
}); });
} }
}, },
...@@ -83,4 +79,4 @@ ...@@ -83,4 +79,4 @@
.slider { .slider {
margin: 1px 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.
先完成此消息的编辑!
想要评论请 注册