<template>
<view class="slider-container" :style="containerStyle" @touchmove.prevent>
<view ref="sliderHandle" class="slider-handle" :style="handleStyle" @touchstart="onTouchStart"
@touchmove.stop="onTouchMove" @touchend="onTouchEnd"></view>
</view>
</template>
<script>
export default {
name: 'SliderControl',
props: {
mode: {
type: String,
default: 'horizontal'
},
width: {
type: [Number, String],
default: 220
},
height: {
type: [Number, String],
default: 60
}
},
data() {
return {
position: 70,
isDragging: false,
startTouch: null,
startPosition: null,
lastUpdate: 0,
lastEmittedValue: 0,
currentDelta: 0,
animationTimer: null
}
},
methods: {
onTouchStart(e) {
uni.vibrateSho