Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复 range-component 在百度小程序下点击获取元素位置信息报错 #3123

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions src/packages/__VUE/range/index.taro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,21 @@ export default create({
state.value.width = rect.width
state.value.height = rect.height
let clientX, clientY
if (Taro.getEnv() === Taro.ENV_TYPE.WEB) {
clientX = event.clientX
clientY = event.clientY
} else {
clientX = event.touches[0].clientX
clientY = event.touches[0].clientY

switch (Taro.getEnv()) {
case Taro.ENV_TYPE.WEB:
clientX = event.clientX
clientY = event.clientY
break
case Taro.ENV_TYPE.SWAN:
clientX = event.changedTouches[0].clientX
clientY = event.changedTouches[0].clientY
break
default:
clientX = event.touches[0].clientX
clientY = event.touches[0].clientY
}

let delta = clientX - rect.left
let total = rect.width
if (props.vertical) {
Expand Down