mirror of
https://gitee.com/TSpecific/tuniao-ui.git
synced 2026-03-13 10:54:01 +08:00
[fix] 修复slider滑块 从v-show隐藏到显示后,出现计算定位错误到问题
This commit is contained in:
@@ -149,6 +149,9 @@
|
|||||||
},
|
},
|
||||||
// 滑动移动中
|
// 滑动移动中
|
||||||
touchMove(event) {
|
touchMove(event) {
|
||||||
|
this._tGetRect('.tn-slider').then(res => {
|
||||||
|
this.sliderRect = res
|
||||||
|
});
|
||||||
if (this.disabled) return
|
if (this.disabled) return
|
||||||
if (!event.changedTouches[0]) return
|
if (!event.changedTouches[0]) return
|
||||||
|
|
||||||
@@ -202,6 +205,9 @@
|
|||||||
},
|
},
|
||||||
// 点击事件
|
// 点击事件
|
||||||
click(event) {
|
click(event) {
|
||||||
|
this._tGetRect('.tn-slider').then(res => {
|
||||||
|
this.sliderRect = res
|
||||||
|
})
|
||||||
if (this.disabled) return
|
if (this.disabled) return
|
||||||
// 直接点击的情况,计算方式和touchMove方法一致
|
// 直接点击的情况,计算方式和touchMove方法一致
|
||||||
const value = (((event.detail.x - this.sliderRect.left) / this.sliderRect.width) * (this.max - this.min)) + this.min
|
const value = (((event.detail.x - this.sliderRect.left) / this.sliderRect.width) * (this.max - this.min)) + this.min
|
||||||
|
|||||||
Reference in New Issue
Block a user