slider-100.uvue 2.3 KB
Newer Older
H
hdx 已提交
1
<template>
DCloud-WZF's avatar
DCloud-WZF 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
  <!-- #ifdef APP -->
  <scroll-view style="flex: 1">
    <!-- #endif -->
    <view class="uni-padding-wrap">
      <slider
        class="first-slider"
        @changing="sliderChanging"
        :value="sliderValue"
        :backgroundColor="sliderBackgroundColor"
        :activeColor="sliderActiveColor"
        :blockColor="sliderBlockColor"
        :show-value="true"
      />
      <view class="flex-row">
        <view class="flex-fill">
          <slider
            v-for="(_, index1) in 25"
            :key="index1"
            class="slider"
            @changing="sliderChanging"
            :value="sliderValue"
            :block-size="sliderBlockSize"
            :show-value="true"
          />
        </view>
        <view class="flex-fill">
          <slider
            v-for="(_, index2) in 25"
            :key="index2"
            class="slider"
            @changing="sliderChanging"
            :value="sliderValue"
            :block-size="sliderBlockSize"
            :show-value="true"
          />
        </view>
        <view class="flex-fill">
          <slider
            v-for="(_, index3) in 25"
            :key="index3"
            class="slider"
            @changing="sliderChanging"
            :value="sliderValue"
            :block-size="sliderBlockSize"
            :show-value="true"
          />
        </view>
        <view class="flex-fill">
          <slider
            v-for="(_, index4) in 25"
            :key="index4"
            class="slider"
            @changing="sliderChanging"
            :value="sliderValue"
            :block-size="sliderBlockSize"
            :show-value="true"
          />
        </view>
H
hdx 已提交
60 61
      </view>
    </view>
DCloud-WZF's avatar
DCloud-WZF 已提交
62 63 64
    <!-- #ifdef APP -->
  </scroll-view>
  <!-- #endif -->
H
hdx 已提交
65 66 67
</template>

<script lang="ts">
DCloud-WZF's avatar
DCloud-WZF 已提交
68 69 70 71 72 73 74 75 76
export default {
  data() {
    return {
      title: 'slider 滑块 x 100',
      sliderValue: 50,
      sliderBlockSize: 20,
      sliderBackgroundColor: '#000000',
      sliderActiveColor: '#FFCC33',
      sliderBlockColor: '#8A6DE9',
H
hdx 已提交
77
    }
DCloud-WZF's avatar
DCloud-WZF 已提交
78 79 80 81 82 83 84
  },
  methods: {
    sliderChanging(e: SliderChangeEvent) {
      this.sliderValue = e.detail.value
    },
  },
}
H
hdx 已提交
85 86 87
</script>

<style>
DCloud-WZF's avatar
DCloud-WZF 已提交
88 89 90
.flex-row {
  flex-direction: row;
}
H
hdx 已提交
91

DCloud-WZF's avatar
DCloud-WZF 已提交
92 93 94
.flex-fill {
  flex: 1;
}
H
hdx 已提交
95

DCloud-WZF's avatar
DCloud-WZF 已提交
96 97 98 99
.first-slider {
  margin: 12px 0;
  background-color: rgba(0, 0, 0, 0.1);
}
H
hdx 已提交
100

DCloud-WZF's avatar
DCloud-WZF 已提交
101 102 103 104
.slider {
  margin: 2px 0.5px;
}
</style>