1
저는 드래그, 회전 및 크기 조절이 가능한 요소를 만들고 있습니다. 기본 구조는 다음과 같습니다.마우스가 div를 떠날 때 마우스를 처리하는 방법은 무엇입니까?
<div class='interactable' @mousedown='handleDown' @mouseup='handleUp'>
</div>
<script>
data: {
dragging: false,
resizing: false,
rotating: false,
},
methods: {
handleDown() {
// code that sets dragging, resizing, rotating to true
}
handleUp() {
this.dragging = false
this.resizing = false
this.rotating = false
}
}
</script>
괜찮습니다. 하나의 문제 : mouseup
이 div
(mouseup
이벤트가 interactable
div에 있기 때문에 의미가 있습니다) 외부로 마우스를 놓으면 트리거되지 않습니다.
이 상황을 처리하는 일반적인 방법은 무엇입니까?
대기 I 분 :
희망의 코드는 자기 설명이다? – alex
어쩌면! 당신은 당신의 필요와 레이아웃에 맞는 논리로 작업해야합니다. –