··· // @mousedown="gotouchstart" @mouseup="gotouchmove" gotouchstart(e) { var disx = e.x - this.refs.dialog_search.getBoundingClientRect().top console.log(this.refs.dialog_search.getBoundingClientRect().left, disy, e) this.loop = setTimeout(() => { this.refs.dialog_search.style.left = e.x - this.refs.dialog_search.style.top = e.y - this.$refs.search_input.getBoundingClientRect().top.toFixed(0) - 20 + 'px' }, 0) window.onmousemove = this.gotouchstart }, // 手释放,如果在500毫秒内就释放,则取消长按事件,此时可以执行onclick应该执行的事件 // gotouchend() {
// },
// 如果手指有移动,则取消所有事件,此时说明用户只是要移动而不是长按
gotouchmove(e) {
window.onmousemove = null
document.onmousemove = null
}
···