slider.uvue 1.3 KB
Newer Older
H
hdx 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<template>
  <view class="uni-padding-wrap">
    <page-head :title="title"></page-head>
    <view class="uni-title">显示当前value</view>
    <view>
      <slider @change="sliderChange" :value="50" :show-value="true" />
    </view>

    <view class="uni-title">设置步进step跳动</view>
    <view>
      <slider @change="sliderChange" :value="60" :step="5" />
    </view>

    <view class="uni-title">设置最小/最大值</view>
    <view>
      <slider @change="sliderChange" :value="100" :min="50" :max="200" :show-value="true" />
    </view>

    <view class="uni-title">不同颜色和大小的滑块</view>
    <view>
H
hdx 已提交
21 22
      <slider class="slider-custom-color-and-size" @change="sliderChange" :value="sliderValue" :backgroundColor="sliderBackgroundColor" :activeColor="sliderActiveColor" :blockColor="sliderBlockColor"
        :block-size="sliderBlockSize" />
H
hdx 已提交
23 24 25 26 27 28 29 30
    </view>
  </view>
</template>

<script lang="ts">
  export default {
    data() {
      return {
H
hdx 已提交
31 32 33 34 35 36
        title: 'slider 滑块',
        sliderValue: 50,
        sliderBlockSize: 20,
        sliderBackgroundColor: '#000000',
        sliderActiveColor: '#FFCC33',
        sliderBlockColor: '#8A6DE9',
H
hdx 已提交
37 38 39 40 41 42 43 44 45 46 47 48
      }
    },
    methods: {
      sliderChange(e : SliderChangeEvent) {
        console.log('value 发生变化:' + e.detail.value)
      }
    }
  }
</script>

<style>
</style>