bug:在拖拽验证拉到尽头会选中表单的文字。
解决方案:
使用onselectstart
这个事件主要是用于禁止选择网页中的文字。代码为:
document.onselectstart =function(){ return false; }
加在拖拽的事件里
const dragFinish = (e: any) => {
document.onselectstart = function () {
return false
}//解决问题的代码在这里
if (isMoving.value && !props.isPassing) {
const _x = (e.pageX || e.changedTouches[0].pageX) - x.value
if (_x < props.width - props.height) {
isOk.value = true
setTimeout(function () {
handler.value.style.left = '0'
handerLeft.value = '0'
progressBar.value.style.width = '0'
isOk.value = false
}, 500)
} else {
handler.value.style.left = props.width - props.height + 'px'
handerLeft.value = props.width - props.height + 'px'
progressBar.value.style.width = props.width + 'px'
passVerify()
}
isMoving.value = false
}
}