mirror of
https://gitee.com/wot-design-uni/wot-design-uni.git
synced 2025-12-07 01:28:30 +08:00
fix: 🐛 修复 wd-slider 滑块不跟手的问题 (#1114)
This commit is contained in:
parent
50782a1671
commit
e3dc36e832
@ -1,10 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<view :class="rootClass" :style="customStyle" :id="sliderId">
|
<view :class="rootClass" :style="customStyle">
|
||||||
<!-- #ifdef MP-DINGTALK -->
|
<!-- #ifdef MP-DINGTALK -->
|
||||||
<view :id="sliderId" style="flex: 1" :class="rootClass">
|
<view style="flex: 1" :class="rootClass">
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
<view :class="`wd-slider__label-min ${customMinClass}`" v-if="!hideMinMax">{{ minProp }}</view>
|
<view :class="`wd-slider__label-min ${customMinClass}`" v-if="!hideMinMax">{{ minProp }}</view>
|
||||||
<view class="wd-slider__bar-wrapper" :style="wrapperStyle">
|
<view class="wd-slider__bar-wrapper" :style="wrapperStyle" :id="sliderBarWrapperId">
|
||||||
<view class="wd-slider__bar" :style="barStyle">
|
<view class="wd-slider__bar" :style="barStyle">
|
||||||
<template v-if="isRange">
|
<template v-if="isRange">
|
||||||
<!-- 左边滑块 -->
|
<!-- 左边滑块 -->
|
||||||
@ -76,7 +76,7 @@ const props = defineProps(sliderProps)
|
|||||||
const emit = defineEmits<SliderEmits>()
|
const emit = defineEmits<SliderEmits>()
|
||||||
|
|
||||||
// ----------- 基础状态 -----------
|
// ----------- 基础状态 -----------
|
||||||
const sliderId = ref<string>(`sliderId${uuid()}`)
|
const sliderBarWrapperId = ref<string>(`sliderBarWrapperId${uuid()}`)
|
||||||
const touch = useTouch()
|
const touch = useTouch()
|
||||||
const touchIndex = ref<number>(0)
|
const touchIndex = ref<number>(0)
|
||||||
const { proxy } = getCurrentInstance() as any
|
const { proxy } = getCurrentInstance() as any
|
||||||
@ -232,7 +232,7 @@ function clamp(value: number, min: number, max: number): number {
|
|||||||
* 初始化滑块宽度
|
* 初始化滑块宽度
|
||||||
*/
|
*/
|
||||||
function initSlider() {
|
function initSlider() {
|
||||||
getRect(`#${sliderId.value}`, false, proxy).then((data) => {
|
getRect(`#${sliderBarWrapperId.value}`, false, proxy).then((data) => {
|
||||||
trackWidth.value = Number(data.width)
|
trackWidth.value = Number(data.width)
|
||||||
trackLeft.value = Number(data.left)
|
trackLeft.value = Number(data.left)
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user