mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(Slider): wrong behavior in two-thumb mode (#11534)
This commit is contained in:
parent
8706f31e8a
commit
5412837a87
@ -65,7 +65,7 @@ export default defineComponent({
|
|||||||
let startValue: SliderValue;
|
let startValue: SliderValue;
|
||||||
|
|
||||||
const root = ref<HTMLElement>();
|
const root = ref<HTMLElement>();
|
||||||
const slider = ref<HTMLElement>();
|
const slider = [ref<HTMLElement>(), ref<HTMLElement>()] as const;
|
||||||
const dragStatus = ref<'start' | 'dragging' | ''>();
|
const dragStatus = ref<'start' | 'dragging' | ''>();
|
||||||
const touch = useTouch();
|
const touch = useTouch();
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={slider}
|
ref={slider[index ?? 0]}
|
||||||
role="slider"
|
role="slider"
|
||||||
class={getButtonClassName(index)}
|
class={getButtonClassName(index)}
|
||||||
tabindex={props.disabled ? undefined : 0}
|
tabindex={props.disabled ? undefined : 0}
|
||||||
@ -321,9 +321,11 @@ export default defineComponent({
|
|||||||
updateValue(props.modelValue);
|
updateValue(props.modelValue);
|
||||||
useCustomFieldValue(() => props.modelValue);
|
useCustomFieldValue(() => props.modelValue);
|
||||||
|
|
||||||
// useEventListener will set passive to `false` to eliminate the warning of Chrome
|
slider.forEach((item) => {
|
||||||
useEventListener('touchmove', onTouchMove, {
|
// useEventListener will set passive to `false` to eliminate the warning of Chrome
|
||||||
target: root,
|
useEventListener('touchmove', onTouchMove, {
|
||||||
|
target: item,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return () => (
|
return () => (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user