Skip to content

Commit e3698ed

Browse files
committed
fix(slider): modify mobile problem
1 parent 926fb6e commit e3698ed

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

packages/mobile/components/slider/src/mobile.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<template>
1313
<div style="position: relative">
1414
<div
15+
ref="slider"
1516
:class="['tiny-mobile-slider', { 'tiny-mobile-slider__vertical': vertical, disabled }]"
1617
:style="{ height: vertical ? height : '' }"
1718
@touchstart="bindMouseDown"
@@ -40,7 +41,7 @@
4041
@mouseleave="hideTip"
4142
@keydown="bindKeyDown"
4243
></div>
43-
<div class="tiny-mobile-slider__tips" v-show="showTip && state.showTip" :style="state.tipStyle">
44+
<div ref="sliderTip" class="tiny-mobile-slider__tips" v-show="showTip && state.showTip" :style="state.tipStyle">
4445
{{ state.tipValue }}
4546
</div>
4647
</div>
@@ -57,12 +58,14 @@
5758

5859
<script lang="ts">
5960
import { renderless, api } from './renderless/vue'
60-
import { props, setup, defineComponent } from '../../../vue-common'
61+
import { $prefix, setup, defineComponent } from '../../../vue-common'
6162
import type { ISliderApi } from './slider'
6263
import { sliderProps } from './slider'
6364
import '@opentiny/vue-theme-mobile/slider/index.less'
6465
6566
export default defineComponent({
67+
name: $prefix + 'Slider',
68+
componentName: 'Slider',
6669
emits: ['update:modelValue', 'change', 'start', 'stop'],
6770
props: sliderProps,
6871
setup(props, context) {

packages/mobile/components/slider/src/renderless/index.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,13 @@ export const bindMouseDown =
9898
let isClickBtn: boolean | undefined = false
9999
let isClickLabel: boolean | undefined = false
100100

101-
if (mode === 'mobile-first') {
102-
const role = Array.from(handleEl.attributes).find((attr) => attr.name === 'role')
103-
const name = role && role.value
101+
isClickBar = hasClass(handleEl, constants.sliderCls(mode)) || hasClass(handleEl, constants.rangeCls(mode))
102+
isClickBtn =
103+
hasClass(handleEl, constants.buttonCls(mode)) ||
104+
hasClass(handleEl, constants.leftSvgCls(mode)) ||
105+
hasClass(handleEl, constants.rightSvgCls(mode))
106+
isClickLabel = hasClass(handleEl, constants.PC_LABEL_CLS)
104107

105-
isClickBar = name === constants.PC_SLIDER_CLS || name === constants.PC_RANGE_CLS
106-
isClickBtn = name === constants.PC_BUTTON_CLS
107-
} else {
108-
isClickBar = hasClass(handleEl, constants.sliderCls(mode)) || hasClass(handleEl, constants.rangeCls(mode))
109-
isClickBtn =
110-
hasClass(handleEl, constants.buttonCls(mode)) ||
111-
hasClass(handleEl, constants.leftSvgCls(mode)) ||
112-
hasClass(handleEl, constants.rightSvgCls(mode))
113-
isClickLabel = hasClass(handleEl, constants.PC_LABEL_CLS)
114-
}
115108
if (state.disabled || (!isClickBtn && !isClickBar && !isClickLabel)) {
116109
state.activeIndex = -1
117110
return

0 commit comments

Comments
 (0)